[issue36207] robotsparser deny all with some rules

2020-07-30 Thread James Gray

James Gray  added the comment:

Bonjour, je vois que nous ne sommes pas les seuls dans ce cas, nous avons 
besoin que les robots indexent nos pages html mais qu'elles n'indexent pas 
celles en /*.php$ ainsi que les ressources PC en PDF. Nous avons tenté en vain 
plusieurs solutions en passant par le robots.txt à la racine de notre domaine 
https://demolinux.org/ mais sans succès. Le RobotsParser ne prends pas ces 
règles en compte, merci.

--
nosy: +Jmgray47

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Winreg

2020-07-30 Thread Eryk Sun
On 7/30/20, R Pasco  wrote:

>   access rights must be set to [winreg.KEY_ALL_ACCESS | winreg.KEY_WOW64_64KEY

It's a bad practice to request more access than you require, at the
very least because the request may fail with access denied for no good
reason.

KEY_ALL_ACCESS includes all applicable standard rights (WRITE_OWNER,
WRITE_DAC, READ_CONTROL, DELETE) and all key rights (KEY_QUERY_VALUE,
KEY_SET_VALUE, KEY_CREATE_SUB_KEY, KEY_ENUMERATE_SUB_KEYS, KEY_NOTIFY,
KEY_CREATE_LINK). For an existing key, do you need to change the
owner, read and modify the security, delete the key, set a symlink,
etc? It looks like you just need to set a value, i.e. KEY_SET_VALUE.

>   winreg.KEY_WOW64_32KEY] (??? Why does this also work ?)

By default a 64-bit process doesn't see redirected keys, but if you
need to access them, use KEY_WOW64_32KEY in the desired access.
Normally a 32-bit process under WOW64 sees redirected keys, and if you
need to access the non-redirected keys, use KEY_WOW64_64KEY.

Note that KEY_WOW64_64KEY and KEY_WOW64_32KEY access modes only affect
runtime redirection. As with the standard MAXIMUM_ALLOWED access mode,
they're not assignable rights that can be granted or denied in a key
object's access control list.

>  with winreg.ConnectRegistry( None, hive ) as hivehndl

There is no need to call ConnectRegistry here. By default, predefined
handles are resolved to local key handles. Also, if you actually need
to access a remote machine, note that it's nonsensical to try to
connect to HKEY_CURRENT_USER. The API allows it, but why would one
assume that the remote machine will have a profile for the current
user's SID? The remote system will most likely just connect to a
handle for the default user profile.

> The key HKEY_LOCAL_MACHINE:SOFTWARE requires KEY_WOW64_64KEY
> to be 'OR'ed. Winreg gives no indication of this requirement, but the
> Windows doc "Redirected, Shared, and Reflected Keys Under WOW64" does
> specifically mention  HKEY_CURRENT_USER :SOFTWARE as needing this added
> access.

At the machine level, the software hive is stored on disk at
"%SystemRoot%\System32\config\SOFTWARE" and mounted at
"\REGISTRY\MACHINE\SOFTWARE". For a WOW64 process, by default there is
extensive runtime redirection of keys in this hive to the subkeys
"WOW6432Node" and "Classes\WOW6432Node".

At the user level, there are two hives mounted. The user profile is
stored on disk at "%USERPROFILE%\NTUSER.DAT" and mounted at
"\REGISTRY\USER\", where "" is the string form of the user's
security identifier (e.g. "S-1-5-21"). For
a WOW64 process, there is no redirection of subkeys that are
physically stored in this hive.

The user's software classes hive is stored on disk at
"%LOCALAPPDATA%\Microsoft\Windows\UsrClass.dat" and mounted at
"\REGISTRY\USER\_Classes". In the user profile, the
"Software\Classes" key is a symbolic link to the latter. For a WOW64
process, some subkeys in the classes hive are redirected to subkeys in
"WOW6432Node" (i.e. "Software\Classes\WOW6432Node"). It's just a
limited subset, including "CLSID", "DirectShow", "Interface", "Media
Type", and "MediaFoundation".

---

One never sees "\REGISTRY\MACHINE" and "\REGISTRY\USER" in the
registry API because it's designed to always use the "RootDirectory"
handle in the native NT object attributes [1]. For local access, the
API maps real handles for "\REGISTRY\MACHINE" and "\REGISTRY\USER" to
the predefined pseudo-handles HKEY_LOCAL_MACHINE and HKEY_USERS.
Similarly, HKEY_CURRENT_USER is mapped to a handle for
"\REGISTRY\USER\", where "" is the string form of the user's
security identifier. For remote access via RegConnectRegistryW (i.e.
winreg.ConnectRegistry), the predefined handles are mapped to
remote-procedure-call (RPC) handles that proxy real key handles on the
remote system.

[1] 
https://docs.microsoft.com/en-us/windows/win32/api/ntdef/ns-ntdef-_object_attributes
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-07-30 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests: +20838
pull_request: https://github.com/python/cpython/pull/21694

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



replying to the mailing list (was: Winreg)

2020-07-30 Thread Cameron Simpson
On 30Jul2020 20:25, Barry Scott  wrote:
>Use the Reply or Reply-To-All feature of your email program and it will do the 
>rest for you.

Plain "reply" is often only "reply-to-author" for many mailers. I use 
"reply-to-all" myself, and edit the headers if that seems excessive.  
Some mailers (eg mutt) also have a "list-reply" operation, which should 
also be correct, arguably more correct.

>> On 30 Jul 2020, at 20:14, R Pasco  wrote:
>> I can't find instructions for the proper way to reply to 'python 
>> list'. Is
>> it simply a matter of keeping the message title identical to the original
>> message and emailing again to python-list@python.org ? I'll reply both ways
>> to test this.

Using the same subject is _not_ enough. Messages are connected together 
with the "In-Reply-To:" header, which is automatically set by your 
mailer's "reply" function (regardless of the flavour mentioned above).

So please just reply to the relevant list message, and make sure the 
list address (python-list@python.org) is in the resulting to/cc.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41441] io reading & updating fix

2020-07-30 Thread 施文峰

Change by 施文峰 :


--
pull_requests: +20837
pull_request: https://github.com/python/cpython/pull/21686

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41274] Better way to random.seed()?

2020-07-30 Thread Juan Jimenez


Juan Jimenez  added the comment:

Pull request https://github.com/python/cpython/pull/21693 created for the demo 
steven.daprano suggested.

--
message_count: 8.0 -> 9.0
pull_requests: +20836
pull_request: https://github.com/python/cpython/pull/21693

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41446] New demo, using a web api

2020-07-30 Thread Juan Jimenez


Change by Juan Jimenez :


--
keywords: +patch
pull_requests: +20835
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21693

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41441] io reading & updating fix

2020-07-30 Thread 施文峰

Change by 施文峰 :


--
pull_requests:  -20829

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41131] Augment random.choices() with the alias method

2020-07-30 Thread Tim Peters


Tim Peters  added the comment:

Oh yes - I understood the intent of the code.  It's as good an approach to 
living with floating-point slop in this context as I've seen.  It's not 
obviously broken.  But neither is it obviously correct, and after a few minutes 
I didn't see a clear path to rigorously proving it can't break.  In FP, if 
there's one chance in 2**53 that it _can_ break, it will ;-)

The suggestions I made change none of that:  reducing the number of rounding 
errors can only help.

OTOH, an all-integer version of the algorithm _can_ be "obviously correct", and 
can embed asserts to verify that it is.  It can all be done in a single 
fixed-size list of 3-lists ([weight, value, alias]), swapping entries as needed 
to keep the 3 regions of interest ("too small", "on the nose", "too large") 
each contiguous.  Then it's straightforward to prove that you run out of "too 
small" entries at the same time you run out of "too large" ones.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6143] IDLE - clear and restart the shell window

2020-07-30 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

@Pokerstar: First we have to agree on several things.

1. What is the need, what are the use cases? When do *you* feel a need to clear 
the shell?

2. What is the basic strategy?
 a. Delete selections: make delete, backspace, and cut work in the shell, as in 
editor.
I prefer this.  No new doc or menu entries needed.
People can delele less than everything.
 b. New feature. All or nothing.  Changes 8 files.  There was discussin of how 
to delete, but seems not difficult.

3. Details need to be agreed on.
  If new feature, menu entry and shortcut: I thing 'Clear shell' is enough.  
Patch disagrees with discussion on shortcut.
  Should header be deleted or left?  (Delete selection lets user decide.)
  Should deleted text be undoable?  We do not currently allow any editing of 
shell history?  Undo amounts to pasting or retyping, and if we do not allow 
pasting or typing in general, why with undo?
  Should squeezes text be expanded?  I think not.  help(tkinter) produces over 
22000 lines.
  Should the current prompt and any code be deleted?  I think not.  If prompt 
gets deleted, it has to be re-written, but without current in-process entry.
  Should remote process be restarted?  Why?  This can easily be done 
independently and might not be wanted.
  

4. New behavior must be tested.  The is usually the hardest part of a patch, 
which is why it is neglected.  Incomplete testing may result in adding a new 
bug.  It was just reported that closing IDLE while the Shell is waiting for a 
response to input(prompt) leads to incomplete shutdown and a zombie process.  
On macOS, this can lead to a crash and possibly a need to reboot.
  So, should we allow clearing, deletion while user code is executing?  While 
user code is requesting input?  Or must we prohibit?  I don't know, other than 
this must be tested at least on Windows and macOS.

Overall, I prefer to use the deletion mechanism we have, rather than add a new 
one.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41131] Augment random.choices() with the alias method

2020-07-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FWIW, I paid close attention to rounding.  The reason for the "while small and 
large" is that the loop stops making aliases unless we have both something at 
or below 0.5 and something known to be above 0.5.  If we end up with only two 
bins slightly above over below 0.5, they are considered close-enough and will 
alias to themselves.

By giving the bins a default alias to themselves, there is always a reasonable 
dispatch in the main sampling loop even if the random() value compares to an 
unfavorably rounded entry in U.

The code assumes that weird roundings will happen through out.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41131] Augment random.choices() with the alias method

2020-07-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Okay, thank you for looking!

--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Winreg

2020-07-30 Thread dn via Python-list

On 31/07/2020 07:25, Barry Scott wrote:

Use the Reply or Reply-To-All feature of your email program and it will do the 
rest for you.



I can't find instructions for the proper way to reply to 'python list'. Is
it simply a matter of keeping the message title identical to the original
message and emailing again to python-list@python.org ? I'll reply both ways
to test this.


Be aware, using "Reply" (only) in at least some 
email-clients/webmail-apps will result in the reply going only to the 
previous-sender cf to the list.

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


[issue37586] macOS: posix_spawn(..., setsid=True)

2020-07-30 Thread Steve Dower


Steve Dower  added the comment:

Oh great, it's one of these style changes :)

You probably want to define some macros for those barriers so the added 
optional nesting doesn't come back to bite us later.

Otherwise, best of luck! Let me know if I can help out (for now I'm just 
ignoring the setsid test).

--
versions: +Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41131] Augment random.choices() with the alias method

2020-07-30 Thread Tim Peters


Tim Peters  added the comment:

I'm not clear on that the alias method is valuable here. Because of the 
preprocessing expense, it cries out for a class instead: an object that can 
retain the preprocessed tables, be saved to disk (pickled), restored later, and 
used repeatedly to make O(1) selections. I have such a class, which uses exact 
integer arithmetic (e.g., during preprocessing, there's at least one "too 
small" bin if and only if there's at least one "too large" bin), and is as 
unbiased as choice() and randrange(). Reasoning about float vagaries is much 
harder, and I see no error analysis here.

Most troubling: that due to rounding, reducing a "too large" bin results in a 
weight that spuriously compares <= bin_size. Then a "too small" bin with a 
genuinely tiny weight can be left with nothing to pair with, and so ends up 
aliasing itself, giving it a massively too-high probability of being picked.

So if you're determined to stick to "a function", I'd stick to the simple 
inverse CDF sampling method.  Unless the number of choices is "very" large, the 
log factor doesn't much matter.

That said, the alias numerics here could be improved some by working with the 
weights directly, "normalizing" them only at the end.  Instead of comparing 
weights to bin_size, compare them instead to the mean:

mean = total / n

(note: the next step to getting rid of floats entirely is to pre-multiply the 
weights by lcm(total, n) // total  - then their mean is exactly the integer 
lcm(total, n) // n).

The mean (instead of bin_size) suffers rounding errors then, but the original 
weights don't during the "hard part" of preprocessing.  At the end,

fn = n + 0.0
U = [weights[i] / total + i / fn for i in range(n)]

instead.  The "i / fn" also suffers just one rounding error as opposed to the 
two in the current "bin_width * i".  That can make a difference for n as small 
as 5:

>>> 3/5
0.6
>>> (1/5)*3
0.6001

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Gtk.TextBuffer problem on converting from GTK+ 2 to GTK+ 3

2020-07-30 Thread Chris Green
MRAB  wrote:
> > 
> > What am I doing wrong?  Virtually nothing has changed in this part of
> > my code between gtk+ 2 and gtk+ 3, just the import and gtk to Gtk and
> > a couple of enum formats.
> > 
> You're creating a TextBuffer and a TextView, but I don't see any code 
> that ties them together. How would the view know to display the contents 
> of the buffer?

Absolutely right, thank you. I should have spotted that.  I think the
Gtk.TextView contructor used to take a buffer parameter but the
version 3 one doesn't so I had removed it. Hence, as you say, no code
tying them together.  I've simply changed to:-

self.view = Gtk.TextView.new_with_buffer(self.buffer)

... and all is well again.


-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Winreg

2020-07-30 Thread Barry Scott
Use the Reply or Reply-To-All feature of your email program and it will do the 
rest for you.

Barry


> On 30 Jul 2020, at 20:14, R Pasco  wrote:
> 
> I can't find instructions for the proper way to reply to 'python list'. Is
> it simply a matter of keeping the message title identical to the original
> message and emailing again to python-list@python.org ? I'll reply both ways
> to test this.
> 
> Yes, it's the 64/32-bit views that got me stuck. I think I've got it mostly
> figured out. The key HKEY_LOCAL_MACHINE:SOFTWARE requires KEY_WOW64_64KEY
> to be 'OR'ed. Winreg gives no indication of this requirement, but the
> Windows doc "Redirected, Shared, and Reflected Keys Under WOW64" does
> specifically mention  HKEY_CURRENT_USER :SOFTWARE as needing this added
> access.
> 
> By the way, I'm running python X64, so the program is a "64 bit"
> application. Strangely, the KEY_WOW64_32KEY access rights param also works
> identically.
> 
> To sum it up the pertinent code, so far, is:
> ==
># Be able to test creating both WOW64 and non-WOW64 key paths.
>if 1 :
>hive = winreg.HKEY_LOCAL_MACHINE
>hivename = 'HKEY_LOCAL_MACHINE'
>else :
>hive = winreg.HKEY_CURRENT_USER
>hivename = 'HKEY_CURRENT_USER'
>#
>parent_keypath = 'Software'   # Both hives happen to have this top
> level key.
>newsubkey = 'AAA New Leaf Key, Process PID={}' .format( os.getpid() )
> 
># Note keys created in HKEY_LOCAL_MACHINE::SOFTWARE will be viewed in
> RegEdit
>#   at HKEY_LOCAL_MACHINE:SOFTWARE\*Wow6432Node*\{newsubkey}.
> CreateKeyEx
>#   access rights must be set to [winreg.KEY_ALL_ACCESS |
> winreg.KEY_WOW64_64KEY]
># -OR-
>#   [winreg.KEY_ALL_ACCESS | winreg.KEY_WOW64_32KEY] (??? Why does this
> also work ?)
>#
>newsubkeyPath = os.path.join( parent_keypath, newsubkey )
> 
>valuename = 'NewString'
>value = 'New String Value'
> 
>with winreg.ConnectRegistry( None, hive ) as hivehndl :
> 
>with winreg.OpenKeyEx( hivehndl, parent_keypath ) as
> parentpath_hndl :
> 
>with winreg.CreateKeyEx( parentpath_hndl, newsubkey, 0,
># winreg.KEY_ALL_ACCESS | winreg.KEY_WOW64_64KEY ) as
> newkeyhndl :
>winreg.KEY_ALL_ACCESS | winreg.KEY_WOW64_32KEY ) as
> newkeyhndl :
> 
>winreg.SetValueEx( newkeyhndl, valuename, 0, winreg.REG_SZ,
> value )
> 
>#end
> ==
> 
> Thanks for all the help.
> Ray Pasco
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Non IDE development strategy - what do others do that's fairly simple?

2020-07-30 Thread Marco Sulla
What you want is a branch, I guess.

https://www.mercurial-scm.org/wiki/Branch

For simplicity, I suggest you have two different directories: one for the
development branch and the other for the production branch.
-- 
https://mail.python.org/mailman/listinfo/python-list


Winreg

2020-07-30 Thread R Pasco
 I can't find instructions for the proper way to reply to 'python list'. Is
it simply a matter of keeping the message title identical to the original
message and emailing again to python-list@python.org ? I'll reply both ways
to test this.

Yes, it's the 64/32-bit views that got me stuck. I think I've got it mostly
figured out. The key HKEY_LOCAL_MACHINE:SOFTWARE requires KEY_WOW64_64KEY
to be 'OR'ed. Winreg gives no indication of this requirement, but the
Windows doc "Redirected, Shared, and Reflected Keys Under WOW64" does
specifically mention  HKEY_CURRENT_USER :SOFTWARE as needing this added
access.

By the way, I'm running python X64, so the program is a "64 bit"
application. Strangely, the KEY_WOW64_32KEY access rights param also works
identically.

To sum it up the pertinent code, so far, is:
==
# Be able to test creating both WOW64 and non-WOW64 key paths.
if 1 :
hive = winreg.HKEY_LOCAL_MACHINE
hivename = 'HKEY_LOCAL_MACHINE'
else :
hive = winreg.HKEY_CURRENT_USER
hivename = 'HKEY_CURRENT_USER'
#
parent_keypath = 'Software'   # Both hives happen to have this top
level key.
newsubkey = 'AAA New Leaf Key, Process PID={}' .format( os.getpid() )

# Note keys created in HKEY_LOCAL_MACHINE::SOFTWARE will be viewed in
RegEdit
#   at HKEY_LOCAL_MACHINE:SOFTWARE\*Wow6432Node*\{newsubkey}.
CreateKeyEx
#   access rights must be set to [winreg.KEY_ALL_ACCESS |
winreg.KEY_WOW64_64KEY]
# -OR-
#   [winreg.KEY_ALL_ACCESS | winreg.KEY_WOW64_32KEY] (??? Why does this
also work ?)
#
newsubkeyPath = os.path.join( parent_keypath, newsubkey )

valuename = 'NewString'
value = 'New String Value'

with winreg.ConnectRegistry( None, hive ) as hivehndl :

with winreg.OpenKeyEx( hivehndl, parent_keypath ) as
parentpath_hndl :

with winreg.CreateKeyEx( parentpath_hndl, newsubkey, 0,
# winreg.KEY_ALL_ACCESS | winreg.KEY_WOW64_64KEY ) as
newkeyhndl :
winreg.KEY_ALL_ACCESS | winreg.KEY_WOW64_32KEY ) as
newkeyhndl :

winreg.SetValueEx( newkeyhndl, valuename, 0, winreg.REG_SZ,
value )

#end
==

Thanks for all the help.
Ray Pasco
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20684] inspect.getfullargspec (etc) incorrectly follows __wrapped__ chains

2020-07-30 Thread Anthony Sottile


Change by Anthony Sottile :


--
nosy: +Anthony Sottile
nosy_count: 3.0 -> 4.0
pull_requests: +20834
pull_request: https://github.com/python/cpython/pull/21100

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: why is requests 2.24 behaving differently on different Win10Pro PCs?

2020-07-30 Thread Barry


> On 29 Jul 2020, at 23:06, nhpython  wrote:
> 
> python 3.6+
> requests 2.24
> 2- windows 10 Pro version 2004, build 19041.388
> 1- kubuntu 18.04
> 1-suse leap 15.2
> 
> Questions
> 1. how do I begin to diagnose the source of the problem?
> 2. Has anyone experienced this behavior?
> 
> 
> I have 4 PCs running the same code. On 3 they work, but 1 fails. 
> 
> I have 2 win10Pros running the same code on the same network on the same 
> subnet, which uses "requests.get()" 1 PC works fine; the code executes 
> perfectly, but the other FAILS. (statusCode = 200, but the website doesn't 
> send webpage) 
> 
> The error response from the website:
> 
> We've detected unusual activity from your computer network
> To continue, please click the box below to let us know you're not a robot. 
> Why did this happen?
> Please make sure your browser supports JavaScript and cookies and that you 
> are not blocking them from loading. For more information you can review our 
> Terms of Service and Cookie Policy.
> 
> BTW, I tried reverting back to "urllib.request" and the same problem appears. 
> 1 PC works the other fails.
> I even tried "HTMLsession" which renders javascript. Same problem.
> 
Sounds like the service you are accessing has a rate limit or other form of 
defence.
And your requests are triggering the defences. What happens if you browse to 
the site?

Barry
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41447] Resource Tracker in Multiprocessing Shared Memory not working correctly

2020-07-30 Thread Damian Barabonkov


New submission from Damian Barabonkov :

The way the resource tracker is used in /Lib/multiprocessing/shared_memory.py 
leads to it issuing warnings/errors, even when resources are cleaned up 
properly.

Attached are two simple demo files copied from the documentation example 
(https://docs.python.org/3.9/library/multiprocessing.shared_memory.html) that 
illustrate the warnings below: 

proc1.py

Traceback (most recent call last):
  File "proc1.py", line 19, in 
shm.unlink()  # Free and release the shared memory block at the very end
  File 
"/home/damian/Documents/QuantCo/miniconda3/envs/pipeline-parallel/lib/python3.8/multiprocessing/shared_memory.py",
 line 244, in unlink
_posixshmem.shm_unlink(self._name)
FileNotFoundError: [Errno 2] No such file or directory: '/shmem'
/home/damian/Documents/QuantCo/miniconda3/envs/pipeline-parallel/lib/python3.8/multiprocessing/resource_tracker.py:218:
 UserWarning: resource_tracker: There appear to be 1 leaked shared_memory 
objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
/home/damian/Documents/QuantCo/miniconda3/envs/pipeline-parallel/lib/python3.8/multiprocessing/resource_tracker.py:231:
 UserWarning: resource_tracker: '/shmem': [Errno 2] No such file or directory: 
'/shmem'
  warnings.warn('resource_tracker: %r: %s' % (name, e))


proc2.py

python3.8/multiprocessing/resource_tracker.py:218: UserWarning: 
resource_tracker: There appear to be 1 leaked shared_memory objects to clean up 
at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

--
files: shmem_bug.py
messages: 374621
nosy: damian.barabonkov
priority: normal
severity: normal
status: open
title: Resource Tracker in Multiprocessing Shared Memory not working correctly
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49351/shmem_bug.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41446] New demo, using a web api

2020-07-30 Thread Juan Jimenez


New submission from Juan Jimenez :

As per a suggestion in https://bugs.python.org/issue41274 I would like to 
submit for consideration a new demo program, one that demonstrates how to use a 
web API to generate a pseudo-random generator seed from high resolution, high 
cadence images of the sun. I will be submitting a pull request for 
consideration.

--
components: Demos and Tools
messages: 374620
nosy: flybd5
priority: normal
severity: normal
status: open
title: New demo, using a web api
type: enhancement
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Gtk.TextBuffer problem on converting from GTK+ 2 to GTK+ 3

2020-07-30 Thread MRAB

On 2020-07-30 17:23, Chris Green wrote:

I'm converting a program from Python 2 gtk+ 2 to Python 3 and gtk+ 3.
It's mostly gone reasonably smoothly but I can't get multi-line text
entry to work.

The class that provides text entry (both single and multi-line) is:-

 #
 #
 # Field on the GUI
 #
 class guiField:
 widget = None
 lines = 1
 #
 #
 # Initialise the field
 #
 def __init__(self, lines=1):
 self.lines = lines
 if (self.lines > 1):
 self.buffer = Gtk.TextBuffer()
 self.view = Gtk.TextView()
 self.view.set_size_request(-1, 24 * lines)
 self.view.set_accepts_tab(False)
 # self.widget = self.view
 self.widget = Gtk.ScrolledWindow()
 self.widget.add(self.view)
 self.widget.set_policy(Gtk.PolicyType.AUTOMATIC, 
Gtk.PolicyType.AUTOMATIC)
 self.widget.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
 else:
 self.widget = Gtk.Entry()
 #
 #
 # get text from field
 #
 def get_text(self):
 if (self.lines > 1):
 [start, end] = self.buffer.get_bounds()
 print(self.buffer.get_text(start, end, False))
 return self.buffer.get_text(start, end, False)
 else:
 return self.widget.get_text()
 #
 #
 # put text into a field
 #
 def set_text(self, text):
 if (self.lines > 1):
 self.buffer.set_text(text)
 else:
 self.widget.set_text(text)


The single line Gtk.Entry widgets work fine, text gets loaded, I can
change it and save it.

The multi-line Gtk.TextBuffer ones refuse to work at all, no errors or
anything but text won't load into them or save out of them.  They used
to work fine in gtk+ 2.

Text loaded into the Gtk.TextBuffer using set_text() doesn't appear,
the text boxes are empty even though the 'text' parameter does have a
string in it (I've checked with a print()).  I can enter text using
the keyboard but that text isn't retrieved by the get_text() method.

What am I doing wrong?  Virtually nothing has changed in this part of
my code between gtk+ 2 and gtk+ 3, just the import and gtk to Gtk and
a couple of enum formats.

You're creating a TextBuffer and a TextView, but I don't see any code 
that ties them together. How would the view know to display the contents 
of the buffer?

--
https://mail.python.org/mailman/listinfo/python-list


Gtk.TextBuffer problem on converting from GTK+ 2 to GTK+ 3

2020-07-30 Thread Chris Green
I'm converting a program from Python 2 gtk+ 2 to Python 3 and gtk+ 3.
It's mostly gone reasonably smoothly but I can't get multi-line text
entry to work.

The class that provides text entry (both single and multi-line) is:-

# 
# 
# Field on the GUI 
# 
class guiField:
widget = None
lines = 1
# 
# 
# Initialise the field 
# 
def __init__(self, lines=1):
self.lines = lines
if (self.lines > 1):
self.buffer = Gtk.TextBuffer()
self.view = Gtk.TextView()
self.view.set_size_request(-1, 24 * lines)
self.view.set_accepts_tab(False)
# self.widget = self.view 
self.widget = Gtk.ScrolledWindow()
self.widget.add(self.view)
self.widget.set_policy(Gtk.PolicyType.AUTOMATIC, 
Gtk.PolicyType.AUTOMATIC)
self.widget.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
else:
self.widget = Gtk.Entry()
# 
# 
# get text from field 
# 
def get_text(self):
if (self.lines > 1):
[start, end] = self.buffer.get_bounds()
print(self.buffer.get_text(start, end, False))
return self.buffer.get_text(start, end, False)
else:
return self.widget.get_text()
# 
# 
# put text into a field 
# 
def set_text(self, text):
if (self.lines > 1):
self.buffer.set_text(text) 
else: 
self.widget.set_text(text) 


The single line Gtk.Entry widgets work fine, text gets loaded, I can
change it and save it.

The multi-line Gtk.TextBuffer ones refuse to work at all, no errors or
anything but text won't load into them or save out of them.  They used
to work fine in gtk+ 2.

Text loaded into the Gtk.TextBuffer using set_text() doesn't appear,
the text boxes are empty even though the 'text' parameter does have a
string in it (I've checked with a print()).  I can enter text using
the keyboard but that text isn't retrieved by the get_text() method.

What am I doing wrong?  Virtually nothing has changed in this part of
my code between gtk+ 2 and gtk+ 3, just the import and gtk to Gtk and
a couple of enum formats.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41445] Adding configure temporary files to gitignore

2020-07-30 Thread fj92f3jj923f923


Change by fj92f3jj923f923 :


--
keywords: +patch
pull_requests: +20833
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21691

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41445] Adding configure temporary files to gitignore

2020-07-30 Thread fj92f3jj923f923


New submission from fj92f3jj923f923 :

I noticed that a lot of files generated and removed due configuring.
I was too scary, when I saw them, and decided to add them to .gitignore.

--
components: Build
messages: 374619
nosy: fj92f3jj923f923
priority: normal
severity: normal
status: open
title: Adding configure temporary files to gitignore
type: enhancement
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Winreg

2020-07-30 Thread Barry Scott
You left python list off your reply.

> On 29 Jul 2020, at 23:38, R Pasco  wrote:
> 
> Hi, Barry,
> 
> On Wed, Jul 29, 2020 at 5:12 PM Barry  > wrote:
> 
> > On 29 Jul 2020, at 19:50, R Pasco  > > wrote:
> > 
> > I'm running python 3.8 on Windows 8.1 x64. Running the following code
> > produces no errors but does not add a key, name or value. I had no problems
> > doing this using _wirreg under python 2.7. Any insight will be helpful.
> 
> How do you check that the key is present?
> 
> I'm using regedit.exe to try to view it. 
> 
> Are you aware that there is one registry for 32 bit code and a separate 
> registry for 64 bit code.
> 
> Only vaguely. Are the "separate" registries really 64 and 32 views of the one 
> and only Registry ? That is, using Winreg ?
> Some examples use "winreg.KEY_ALL_ACCESS | winreg.KEY_WOW64_32KEY" as the 
> access mode. Not sure what this does.
> I am using python 64-bit, so what should the argument value "access=" be set 
> to in the call to "winreg.CreateKeyEx()" ?

Yes they are views.

I cannot remember the details, but I suggest that you look up the details on 
microsoft's MSDN for the info you need.

Searching for KEY_WOW64_32KEY takes you into thoses docs for example.

Barrry

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41444] CPython 3.8.5 fails to build on Windows with -E option

2020-07-30 Thread Vladislav Mikhalin


Vladislav Mikhalin  added the comment:

The documentation states:
  -E  Don't fetch or build external libraries.  Extension modules that
  depend on external libraries will not attempt to build if this flag
  is present; -e is also accepted to explicitly enable fetching and
  building externals.

So, according to this, any module that is dependent on external libraries will 
not be built. Ant it was working with 3.7.5.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: How to find code that causes a 'deprecated' warning?

2020-07-30 Thread Chris Green
Peter Otten <__pete...@web.de> wrote:
> Chris Green wrote:
> 
> > I am getting the following warning from a program I have just
> > converted from gtk 2 to gtk 3 :-
> > 
> > (abook:58240): Gtk-WARNING **: 12:01:58.064: Theme parsing error:
> > gtk.css:66:28: The :prelight pseudo-class is deprecated. Use :hover
> > instead.
> > 
> > How do I find what is causing the warning?  I'm not using the prelight
> > pseudo-class directly in my code anywhere.
> 
> >From reading the message I would guess that the culprit is the file gtk.css, 
> line 66 specifically ;)
> 
Oops, yes! :-)  I guess that came with the [x]ubuntu installation,
it's in ~/.config/gtk-3.0/gtk.css so I deny any responsibility for it!

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What's the enum for a button press event in pygobject 3?

2020-07-30 Thread Chris Green
MRAB  wrote:
> On 2020-07-30 11:09, Chris Green wrote:
> > I am going round and round in steadily increasing frustration trying
> > to find the constants for button events in Pygobject/Gtk 3.
> > 
> > I have the following imports:-
> > 
> >  import gi
> >  gi.require_version('Gtk', '3.0')
> >  from gi.repository import Gtk
> >  from gi.repository import Gdk
> > 
> > 
> > The old GTK 2 code had (I think):-
> > 
> >  if (event.type == gtk.gdk.BUTTON_PRESS):
> > 
> > 
> > So what is BUTTON_PRESS in the new version, I simply can't find a
> > straightforward description of it or example of its use.
> > 
> > 
> I believe it's:
> 
> Gdk.EventType.BUTTON_PRESS
> 
> There's documentation here:
> 
> https://lazka.github.io/pgi-docs/#Gdk-3.0/enums.html#Gdk.EventType.BUTTON_PRESS

Brilliant, thank you, just what I needed.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41444] CPython 3.8.5 fails to build on Windows with -E option

2020-07-30 Thread Steve Dower


Steve Dower  added the comment:

Yes, if you use -E then you need to provide the dependencies in some other way.

The option is there to suppress network access at build time, not to build 
without those modules.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



pip 20.2 release, plus changes coming in 20.3

2020-07-30 Thread Sumana Harihareswara
On behalf of the Python Packaging Authority, I am pleased to announce 
that we have just released pip 20.2, a new version of pip. You can 
install it by running python -m pip install --upgrade pip.


The highlights for this release are:

   - The beta of the next-generation dependency resolver is available
   - Faster installations from wheel files
   - Improved handling of wheels containing non-ASCII file contents
   - Faster `pip list` using parallelized network operations
   - Installed packages now contain metadata about whether they were
   directly
   requested by the user (PEP 376’s REQUESTED file)

The new dependency resolver is *off by default* because it is *not yet
ready for everyday use*. The new dependency resolver is significantly
stricter and more consistent when it receives incompatible instructions,
and reduces support for certain kinds of constraints files, so some
workarounds and workflows may break. Please test it with the
`--use-feature=2020-resolver` flag. Please see our guide on how to test 
and migrate, and how to report issues

.

We are preparing to change the default dependency resolution behavior 
and make the new resolver the default in pip 20.3 (in October 2020).


This release also partially optimizes pip’s network usage during
installation (as part of a Google Summer of Code project by McSinyx
). 
Please test it with `pip install --use-feature=2020-resolver 
--use-feature=fast-deps` and report bugs to the issue tracker

. This
functionality is *still experimental* and *not ready for everyday use*.

You can find more details (including deprecations and removals) in the
changelog .

As with all pip releases, a significant amount of the work was 
contributed by pip’s user community. Huge thanks to all who have 
contributed, whether through code, documentation, issue reports and/or 
discussion. Your help keeps pip improving, and is hugely appreciated.


Specific thanks go to Mozilla (through its Mozilla Open Source Support
 Awards) and to the Chan Zuckerberg
Initiative  DAF, an advised fund of
Silicon Valley Community Foundation, for their funding that enabled
substantial work on the new resolver.


--
Sumana Harihareswara
pip project manager via contract with PSF
Changeset Consulting
https://changeset.nyc
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


pip 20.2 release, plus changes coming in 20.3

2020-07-30 Thread Sumana Harihareswara
On behalf of the Python Packaging Authority, I am pleased to announce 
that we have just released pip 20.2, a new version of pip. You can 
install it by running python -m pip install --upgrade pip.


The highlights for this release are:

   - The beta of the next-generation dependency resolver is available
   - Faster installations from wheel files
   - Improved handling of wheels containing non-ASCII file contents
   - Faster `pip list` using parallelized network operations
   - Installed packages now contain metadata about whether they were
   directly
   requested by the user (PEP 376’s REQUESTED file)

The new dependency resolver is *off by default* because it is *not yet
ready for everyday use*. The new dependency resolver is significantly
stricter and more consistent when it receives incompatible instructions,
and reduces support for certain kinds of constraints files, so some
workarounds and workflows may break. Please test it with the
`--use-feature=2020-resolver` flag. Please see our guide on how to test 
and migrate, and how to report issues

.

We are preparing to change the default dependency resolution behavior 
and make the new resolver the default in pip 20.3 (in October 2020).


This release also partially optimizes pip’s network usage during
installation (as part of a Google Summer of Code project by McSinyx
). 
Please test it with `pip install --use-feature=2020-resolver 
--use-feature=fast-deps` and report bugs to the issue tracker

. This
functionality is *still experimental* and *not ready for everyday use*.

You can find more details (including deprecations and removals) in the
changelog .

As with all pip releases, a significant amount of the work was 
contributed by pip’s user community. Huge thanks to all who have 
contributed, whether through code, documentation, issue reports and/or 
discussion. Your help keeps pip improving, and is hugely appreciated.


Specific thanks go to Mozilla (through its Mozilla Open Source Support
 Awards) and to the Chan Zuckerberg
Initiative  DAF, an advised fund of
Silicon Valley Community Foundation, for their funding that enabled
substantial work on the new resolver.


--
Sumana Harihareswara
pip project manager via contract with PSF
Changeset Consulting
https://changeset.nyc
--
https://mail.python.org/mailman/listinfo/python-list


Re: What's the enum for a button press event in pygobject 3?

2020-07-30 Thread MRAB

On 2020-07-30 11:09, Chris Green wrote:

I am going round and round in steadily increasing frustration trying
to find the constants for button events in Pygobject/Gtk 3.

I have the following imports:-

 import gi
 gi.require_version('Gtk', '3.0')
 from gi.repository import Gtk
 from gi.repository import Gdk


The old GTK 2 code had (I think):-

 if (event.type == gtk.gdk.BUTTON_PRESS):


So what is BUTTON_PRESS in the new version, I simply can't find a
straightforward description of it or example of its use.



I believe it's:

Gdk.EventType.BUTTON_PRESS

There's documentation here:

https://lazka.github.io/pgi-docs/#Gdk-3.0/enums.html#Gdk.EventType.BUTTON_PRESS
--
https://mail.python.org/mailman/listinfo/python-list


questions re: calendar module

2020-07-30 Thread o1bigtenor
Greetings

I regularly work in planning through multiple years at once.
This means that I like to have a lot of stuff available in a calendar
function.
Python seems to be locked when I need to display more than 1 year at a
time.

I don't see a way to display something like 3 years worth of calendar
starting at a point 23 months from now.
(I see how to display 1 year at a time but not multiple years.)

Is there a way to do this?

TIA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41330] Inefficient error-handle for CJK encodings

2020-07-30 Thread Dong-hee Na


Dong-hee Na  added the comment:

I am also +1 on Serhiy's opinion.

As I am Korean, (I don't know Japan or China environment)
I know that there still exist old Korean websites that use EUC-KR encoding.
But at least 2010s modern Korea website/application.
Most of the applications are built on UTF-8.

--
nosy: +corona10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: How to diagnose import error when importing from .so file?

2020-07-30 Thread Christian Gollwitzer

Am 29.07.20 um 23:01 schrieb Chris Green:

Even more annoying is that most of what's in pyscand.so is constants,
there's only a couple of functions in there, so there's very little to
it really.

If there are really only constants, you could import it into Python 2 
and dump the content e.g. as a JSON file to read it in under Python 3.


Christian
--
https://mail.python.org/mailman/listinfo/python-list


[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-30 Thread Dong-hee Na


Dong-hee Na  added the comment:

https://www.garykessler.net/library/file_sigs.html looks like a good resource 
for this kind of API.

However, I would like to choose well-known standard from whatwg or w3c etc..

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Issue with Python installation for a beginner Python coder.

2020-07-30 Thread Sarvesh Poddar via Python-list
Hi,
I re-installed Python in my Windows system as the earlier one was not able to 
import modules. But now I am not able to open IDLE after multiple tries. 
Can you guys help me? I am a beginner and tried out a lot of solutions provided 
on the internet and it's just not getting fixed.
Please help. I look forward to it. 
PS : Falling in love with Python, slow and steady! 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to find code that causes a 'deprecated' warning?

2020-07-30 Thread Peter Otten
Chris Green wrote:

> I am getting the following warning from a program I have just
> converted from gtk 2 to gtk 3 :-
> 
> (abook:58240): Gtk-WARNING **: 12:01:58.064: Theme parsing error:
> gtk.css:66:28: The :prelight pseudo-class is deprecated. Use :hover
> instead.
> 
> How do I find what is causing the warning?  I'm not using the prelight
> pseudo-class directly in my code anywhere.

>From reading the message I would guess that the culprit is the file gtk.css, 
line 66 specifically ;)


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41444] CPython 3.8.5 fails to build on Windows with -E option

2020-07-30 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41444] CPython 3.8.5 fails to build on Windows with -E option

2020-07-30 Thread Vladislav Mikhalin


New submission from Vladislav Mikhalin :

These errors are generated on a clean build:

C:\cpython-3.8.5\Modules\_ctypes\_ctypes.c(107,10): fatal error C1083: Cannot 
open include file: 'ffi.h': No such file or directory 
[C:\cpython-3.8.5\PCbuild\_ctypes.vcxproj]
C:\cpython-3.8.5\Modules\_ctypes\callbacks.c(4,10): fatal error C1083: Cannot 
open include file: 'ffi.h': No such file or directory 
[C:\cpython-3.8.5\PCbuild\_ctypes.vcxproj]
C:\cpython-3.8.5\Modules\_ctypes\callproc.c(71,10): fatal error C1083: Cannot 
open include file: 'ffi.h': No such file or directory 
[C:\cpython-3.8.5\PCbuild\_ctypes.vcxproj]
C:\cpython-3.8.5\Modules\_ctypes\cfield.c(3,10): fatal error C1083: Cannot open 
include file: 'ffi.h': No such file or directory 
[C:\cpython-3.8.5\PCbuild\_ctypes.vcxproj]
C:\cpython-3.8.5\Modules\_ctypes\malloc_closure.c(2,10): fatal error C1083: 
Cannot open include file: 'ffi.h': No such file or directory 
[C:\cpython-3.8.5\PCbuild\_ctypes.vcxproj]
C:\cpython-3.8.5\Modules\_ctypes\stgdict.c(2,10): fatal error C1083: Cannot 
open include file: 'ffi.h': No such file or directory 
[C:\cpython-3.8.5\PCbuild\_ctypes.vcxproj]

--
components: Build
messages: 374614
nosy: Vladislav Mikhalin
priority: normal
severity: normal
status: open
title: CPython 3.8.5 fails to build on Windows with -E option
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41360] method _tunnel does not allow for a standard proxy authentication solution

2020-07-30 Thread Вадим Новиков

Change by Вадим Новиков :


--
nosy: +Вадим Новиков

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



pytest 6.0.1

2020-07-30 Thread Bruno Oliveira
pytest 6.0.1 has just been released to PyPI.

This is a bug-fix release, being a drop-in replacement. To upgrade::

  pip install --upgrade pytest

The full changelog is available at
https://docs.pytest.org/en/latest/changelog.html.

Thanks to all who contributed to this release, among them:

* Bruno Oliveira
* Mattreex
* Ran Benita
* hp310780


Happy testing,
The pytest Development Team
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue41411] Improve and consolidate f-strings docs

2020-07-30 Thread Ezio Melotti


Ezio Melotti  added the comment:

Thanks both for pointing out the additional section in inputoutput.rst that I 
initially missed.

> I have done PR 21681 that adds index to the tutorial although searching[2][3] 
> does not seem to be better now that the reference has an index.

The online docs seem updated, so I'm not sure why it's not working. Maybe you 
could try moving things around and see if you can make it work?  You should be 
able to build the docs locally and test from there.  You can also see if Sphinx 
raises any warning during the build process, try to move the `.. index` 
directive just after the section title (instead of before), or add an empty 
line between the list of entries and the section label (unnecessary if you move 
the entries after the title). 

> This is there[0] but it _IS_ hard to find, when you don't know it is there.

I noticed (or rather, I didn't :)!

> It may not be very "introduction-y", and if you like I can make a go at 
> trying to reword it.

I think this section is fine, the only thing that needs to be update is the 
link at the end of the section to point to the main f-string section that we 
will add elsewhere.

>> The stdtypes page is already quite long and crowded ...
> True. But is this wrong? In my feeling this is reference documentation. It 
> should be accurate, complete and clear. It may not need to be "textbook-like".

You might be right.

> Some thoughts:
> - There may be benefit in reorganising stdtypes.rst to improve the flow 
> without changing the actual content. This could mean breaking it up into a 
> number of documents rather than the monolith it is.

Both in the documentation and in the code, there are advantages in having 
everything on a single page/file (such as easier ctrl+f search) but also 
disadvantages.  Given the goal of the page, I think keeping it monolithic is 
fine: it provides a summary of all the built-in types in a single place.  
Breaking it down into multiple pages will have other issues.  If you make a 
page per type, you will have some pages that are very short, and it will be 
more difficult to get an overview of all the types, comparing them, and 
searching through all of them at once. 

> - It does feel like printf[4] was plugged in later because str.format()[5] 
> had been explained earlier. (Although I believe printf came before 
> str.format()). A first time reader of the document will find it hard to know 
> the one way that is right when it comes to formatting.

If I recall correctly that section has also been there, but initially it was 
just describing the standard way of doing string formatting, and when 
str.format() was added, it got renamed and the note at the top was added to 
link to the str.format() documentation.  I guess that the str.format 
documentation ended up in string.rst because it was related to 
string.formatter, and the author wanted to keep them together.

> - f-strings should probably also be described here because it _is_ built in, 
> no? It may not be accurate to say it is in /Lib/strings. There is no 
> reference that a developer can just look at to remind/confirm to themselves 
> how to "do it".

Agreed, stdtypes.rst would be the right place where to document this, my only 
concerns were: 1) the size of the page (that as said above, is not such a big 
deal); 2) keeping str.format() and string.Formatter() together (but this is 
also not a huge concern).

Also note that str.format() is not documented in stdtypes.rst, however there is 
an entry for str.format() with a clear link to the formatting docs, so I never 
had a problem finding it, even if I needed an extra click.

[...]

> But now (and this is mainly to me) it appears that another problem is a need 
> to consistently, clearly, and in one place describe the various 
> elements/nuances/eccentricities of presenting data in Python: 
>  - string
>  - string.Formatter,
>  - string.Template,
>  - str.format()
>  - f-string
>  - Format Specification Mini-Language
>  - maybe even __format__ and conversion?
>  - etc

What about doing the following:
* keep having stdtypes.rst cover and explain all the built-in types and their 
features;
* move the "Format String Syntax", "Format Specification Mini-Language", 
"Format examples" sections from string.rst to stdtypes.rst where they belong;
* integrate f-strings in these sections, and add a new section explaining 
f-string-specific quirks;
* leave the printf-style string formatting in stdtypes.rst, after the format 
sections
* use string.rst to document the string module and its objects, hence leaving 
string.Formatter and string.Template here, where they belong (string.Formatter 
is self contained enough that doesn't need to be with the other format 
sections);
* leave the inputoutput.rst and lexical_analysis pages as they are;
* update the introduction.rst page to mention f-string;
* once all this is done, update all links to point to the appropriate sections 
and cross-link all related sections;


[issue40045] Make "dunder" method documentation easier to locate

2020-07-30 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Closing as fixed. Thanks Hilit.

--
nosy: +xtreak
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41435] Allow to retrieve ongoing exception handled by every threads

2020-07-30 Thread Julien Danjou


Change by Julien Danjou :


--
keywords: +patch
pull_requests: +20832
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21689

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



How to find code that causes a 'deprecated' warning?

2020-07-30 Thread Chris Green
I am getting the following warning from a program I have just
converted from gtk 2 to gtk 3 :-

(abook:58240): Gtk-WARNING **: 12:01:58.064: Theme parsing error:
gtk.css:66:28: The :prelight pseudo-class is deprecated. Use :hover
instead.

How do I find what is causing the warning?  I'm not using the prelight
pseudo-class directly in my code anywhere.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-07-30 Thread David Halter


David Halter  added the comment:

@gvanrossum

> Does parso have to be pure Python? If not, we could generate C code like we 
> do for CPython's parser. 

I would rather write the parser either in C or Rust. So no, parso does not need 
to be pure Python.

> Now, that doesn't work for incremental parsing, but I did an alternative 
> implementation that uses a stack machine, also in C, that's only 2x slower 
> than the PEG parser. Maybe that could be adapted to incremental parsing 
> (because it's a stack machine). Error recovery is still a research project 
> (at least for me -- I'm actually reading papers :-).

Makes sense! I was also thinking about GLL parsing. Obviously GLL does not 
cover all cases where PEG could potentially work, but I doubt that Python ever 
moves to a place where GLL would not be sufficient.

I'm also doing a bit of research on Rust parsers and trying to find a solution 
for my parsing needs in the future. (I'd rather have a Rust parser than a C 
one, because I like the language better and both should still work in Python).

Please let me know if you're making a lot of progress with PEG parsers and 
error recovery/incremental parsing. I'm definitely interested in copying an 
approach if it works :).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41443] some test cases in test_posix.py fail if some os attributes are not supported

2020-07-30 Thread Peixing Xin


Change by Peixing Xin :


--
keywords: +patch
pull_requests: +20831
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21688

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41443] some test cases in test_posix.py fail if some os attributes are not supported

2020-07-30 Thread Peixing Xin


New submission from Peixing Xin :

Some operating systems like VxWorks can't support posix.chown, posix.mknod and 
posix.readlink. This results that test_chown_dir_fd, test_mknod_dir_fd and 
test_readlink_dir_fd fail.

--
components: Tests
messages: 374610
nosy: pxinwr
priority: normal
severity: normal
status: open
title: some test cases in test_posix.py fail if some os attributes are not 
supported
type: behavior
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



What's the enum for a button press event in pygobject 3?

2020-07-30 Thread Chris Green
I am going round and round in steadily increasing frustration trying
to find the constants for button events in Pygobject/Gtk 3.

I have the following imports:-

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk


The old GTK 2 code had (I think):-

if (event.type == gtk.gdk.BUTTON_PRESS):


So what is BUTTON_PRESS in the new version, I simply can't find a
straightforward description of it or example of its use.


-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41442] test_posix.PosixTester.test_getgroups fail on operating systems without supporting unix shell

2020-07-30 Thread Peixing Xin


Change by Peixing Xin :


--
keywords: +patch
pull_requests: +20830
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21687

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41441] io reading & updating fix

2020-07-30 Thread 施文峰

Change by 施文峰 :


--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41442] test_posix.PosixTester.test_getgroups fail on operating systems without supporting unix shell

2020-07-30 Thread Peixing Xin


New submission from Peixing Xin :

test_posix.PosixTester.test_getgroups requires unix shell supported on tested 
platform. However some operating systems like VxWorks doesn't support unix 
shell. This case will fail on it.

--
components: Tests
messages: 374609
nosy: pxinwr
priority: normal
severity: normal
status: open
title: test_posix.PosixTester.test_getgroups fail on operating systems without 
supporting unix shell
type: behavior
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40075] _tkinter PythonCmd fails to acquire GIL

2020-07-30 Thread E. Paine


E. Paine  added the comment:

Thanks Steve for your explanation. I had a quick experiment with the 
ENTER_PYTHON definition and initially just added a call to PyThreadState_Get if 
the tstate was NULL. This still crashed the interpreter with the following 
error (which I think reaffirms Steve's explanation):

Fatal Python error: PyThreadState_Get: the function must be called with the GIL 
held, but the GIL is released (the current Python thread state is NULL)

To work-around this error, I temporarily acquired the GIL and then released it 
after the call to PyThreadState_Get. The result worked correctly and can be 
found in the attached diff. I am not saying that the attached diff is the 
solution, but I don't think we need to stop using tstate in favour of the 
gstate introduced in the PR.

> I could not reproduce the crash without showing any non-tk dialog.

That would help explain why I cannot reproduce it on Linux - it is differences 
in the windowing API under Tcl not some platform-specific code in Tcl/Tk or 
_tkinter.

--
Added file: https://bugs.python.org/file49350/tstate_acquire.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41441] io reading & updating fix

2020-07-30 Thread 施文峰

施文峰  added the comment:

Please refer to the test case-  https://github.com/841020/open_source

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41323] Perform "peephole" optimization directly on control-flow graph.

2020-07-30 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 6e8128f02e1d36e38e5866f9dc36e051caa47bc9 by Mark Shannon in 
branch 'master':
bpo-41323: Perform 'peephole' optimizations directly on the CFG. (GH-21517)
https://github.com/python/cpython/commit/6e8128f02e1d36e38e5866f9dc36e051caa47bc9


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41323] Perform "peephole" optimization directly on control-flow graph.

2020-07-30 Thread Mark Shannon


Change by Mark Shannon :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41441] io reading & updating fix

2020-07-30 Thread 施文峰

Change by 施文峰 :


--
resolution:  -> fixed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41395] pickle and pickletools cli interface doesn't close input and output file.

2020-07-30 Thread Sebastien Williams-Wynn


Change by Sebastien Williams-Wynn :


--
nosy: +s.williams-wynn

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41441] io reading & updating fix

2020-07-30 Thread 施文峰

New submission from 施文峰 :

happen at io's reading & updating(r+) mode
if you remove whole content ( truncate(0) ), tell wil not back to 0
then you start writing will start at current position
that's why problem happen

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41441] io reading & updating fix

2020-07-30 Thread 施文峰

Change by 施文峰 :


--
keywords: +patch
pull_requests: +20829
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21686

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41441] io reading & updating fix

2020-07-30 Thread 施文峰

Change by 施文峰 :


--
components: IO
nosy: ke265379ke
priority: normal
severity: normal
status: open
title: io  reading & updating fix
type: enhancement
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41177] ConvertingList and ConvertingTuple lack iterators and ConvertingDict lacks items()

2020-07-30 Thread Brett Hannigan


Brett Hannigan  added the comment:

Just wanted to check-in to see if there were any updates on my proposed PR?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37586] macOS: posix_spawn(..., setsid=True)

2020-07-30 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

That's this issue.

FWIW: I'm slowly working on a patch to build on macOS 11 and deploy to macOS 
10.9 or later, the current rough and untested PR is at 
https://github.com/python/cpython/pull/21583. 

This needs testing and cleanup before it can be considered for merging.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40075] _tkinter PythonCmd fails to acquire GIL

2020-07-30 Thread Thomas Holder


Thomas Holder  added the comment:

Attaching an even simpler example which doesn't use PyQt. It shows a native 
Windows dialog using ctypes. I could not reproduce the crash without showing 
any non-tk dialog.

Steve's explanation sounds plausible.

--
Added file: https://bugs.python.org/file49349/simple_tk_demo.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41440] os.cpu_count doesn't work on VxWorks RTOS

2020-07-30 Thread Peixing Xin


Change by Peixing Xin :


--
keywords: +patch
pull_requests: +20828
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21685

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41440] os.cpu_count doesn't work on VxWorks RTOS

2020-07-30 Thread Peixing Xin


New submission from Peixing Xin :

Now os.cpu_count() always returns NONE on VxWorks RTOS. It needs to be fixed 
particularly for VxWorks.

--
components: Library (Lib)
messages: 374601
nosy: pxinwr
priority: normal
severity: normal
status: open
type: enhancement
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41439] some test cases in test_uuid.py and test_ssl.py fail on some operating systems because of no os.fork support

2020-07-30 Thread Peixing Xin


Change by Peixing Xin :


--
keywords: +patch
pull_requests: +20827
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21684

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40045] Make "dunder" method documentation easier to locate

2020-07-30 Thread Hilit Oreny


Hilit Oreny  added the comment:

This issue has been resolved (thanks to @javadmokhtari and @nanjekyejoannah), 
but its Status is still "open" and the Resolution is blank...
Members of Python triage team, please change the Status to "closed" and  the 
Resolution to "fixed".
Thank you!

--
nosy: +HO

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41439] some test cases in test_uuid.py and test_ssl.py fail on some operating systems because of no os.fork support

2020-07-30 Thread Peixing Xin


New submission from Peixing Xin :

Some operating systems, for example VxWorks RTOS, don't support fork(). Some 
test cases that depend on os.fork() will fail. 
test_ssl.BasicSocketTests.test_random_fork and 
test_uuid.TestUUIDWithExtModule.testIssue8621 fail are this case.

--
components: Tests
messages: 374599
nosy: pxinwr
priority: normal
severity: normal
status: open
title: some test cases in test_uuid.py and test_ssl.py fail on some operating 
systems because of no os.fork support
type: behavior
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com