[issue36661] Missing dataclass decorator import in dataclasses module docs

2019-06-23 Thread Prateek Nayak


Change by Prateek Nayak :


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

___
Python tracker 

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



[issue37378] FatalError: initfsencoding python couldn't find codec Module not found: Encodings

2019-06-23 Thread Inada Naoki


Inada Naoki  added the comment:

You can use `where pip` to find which pip is used.
And you can check `PATH` environment variable and remove unused PATHs.

--
resolution:  -> not a bug
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



[issue37378] FatalError: initfsencoding python couldn't find codec Module not found: Encodings

2019-06-23 Thread Lokesh Chandak


Lokesh Chandak  added the comment:

Thank Inada Naoki, I can confirm that python -m pip works as normal and I can 
resume my work.
However pip is still causing the errors, and not just pip, it was also the same 
for pip3 and pip3.7 as well as easy_install. I guess I will wait for future 
updates to solve this.
(Also, just one question: how could python -m pip work but not pip? What are 
the differences in them?

--

___
Python tracker 

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



[issue37348] Optimize PyUnicode_FromString for short ASCII strings

2019-06-23 Thread Inada Naoki


Change by Inada Naoki :


--
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



[issue37348] Optimize PyUnicode_FromString for short ASCII strings

2019-06-23 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 770847a7db33b3d4c451b42372b6942687aa6121 by Inada Naoki in branch 
'master':
bpo-37348: optimize decoding ASCII string (GH-14283)
https://github.com/python/cpython/commit/770847a7db33b3d4c451b42372b6942687aa6121


--

___
Python tracker 

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



[issue37374] Minidom does not have to escape quote inside text segments

2019-06-23 Thread Daniel Hilst Selli


Daniel Hilst Selli  added the comment:

This changes behavior in an irreversible way. A parameter would make it 
reversible.

--

___
Python tracker 

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



[issue37381] Script using ProactorEventLoop does not exit cleanly when subprocesses are spawned.

2019-06-23 Thread William D. Jones


Change by William D. Jones :


--
title: Script using ProactorEventLoop does not exit cleanly on Windows with 
multiple subprocesses -> Script using ProactorEventLoop does not exit cleanly 
when subprocesses are spawned.

___
Python tracker 

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



[issue37284] Not obvious that new required attrs of sys.implementation must have a PEP.

2019-06-23 Thread Giovanni Cappellotto


Change by Giovanni Cappellotto :


--
keywords: +patch
pull_requests: +14148
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/14328

___
Python tracker 

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



[issue36661] Missing dataclass decorator import in dataclasses module docs

2019-06-23 Thread Mark turner


Mark turner  added the comment:

I tried a couple of the examples from the docs and found the setup to be a 
little confusing
amd inconsistent. For example, the decorator line "@decorator" requires you to 
use

from dataclasses import dataclass

while the example line "mylist: List[int] = field(default_factory=list)" 
requires you to use these

import dataclasses
import typing

and must be modified to
mylist: typing.List[int] = dataclasses.field(default_factory=list)

The decorator line could be modified to be
@dataclasses.dataclass
and the from/import line could be eliminated. But that seems awkward.

So, what is are best practices for handling the imports needed by these 
examples?
And should the examples be updated to be consistent with a best practice set of 
imports?
Or am I not understanding how this code works?

Also, the intro section states "If any of the added methods already exist on 
the class, a TypeError will be raised."
This statement seems incorrect and contrdicts the parameter documentation that 
follows.

--
nosy: +mturner865

___
Python tracker 

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



[issue37373] Configuration of windows event loop for libraries

2019-06-23 Thread Yury Selivanov


Yury Selivanov  added the comment:

+1 to what Ben said.

Andrew,

> The proposal looks like a very dirty hack and smells as it is.

I wonder why are you feeling like that about this idea.  I don't think this is 
a hack at all.  There's no native API, so we're forced to use another approach.

> There is no very strong reason to apply it.

I think there's such a reason.  asyncio has a well defined API that people use 
and create programs dependent on it.  And then people learn that the API isn't 
really supported on Windows with one loop, or when it is supported, other APIs 
aren't.  They are then forced to either not support Windows or to rewrute their 
programs.  The situation further complicates if they are using third-party code.

This is a very unfortunate and weird position we put our users into.  So this 
indeed is a perfect example where "practicality beats purity" principle should 
be invoked.

--

___
Python tracker 

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



[issue37373] Configuration of windows event loop for libraries

2019-06-23 Thread Ben Darnell


Ben Darnell  added the comment:

Yeah, it's definitely a hack. The argument for it, at best, is "practicality 
beats purity". The solution is two simple lines, but those lines need to be 
repeated in every project that depends on Tornado and cares about Windows, now 
or in the future. How many projects have to be affected to justify a hack like 
this? I'm not sure, but without this hack the add_reader methods, and by 
extension Tornado, will remain a compatibility trap.

--

___
Python tracker 

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



[issue37381] Script using ProactorEventLoop does not exit cleanly on Windows with multiple subprocesses

2019-06-23 Thread William D. Jones


William D. Jones  added the comment:

Update: It turns out multiple spawned subprocesses are NOT required. If I 
replace "(short_fut, _) = await spawn()" with "short_fut = 
asyncio.ensure_future(asyncio.sleep(4))", the hang still occurs.

--

___
Python tracker 

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



[issue37381] Script using ProactorEventLoop does not exit cleanly on Windows with multiple subprocesses

2019-06-23 Thread William D. Jones


New submission from William D. Jones :

On Windows 7, when using ProactorEventLoop, when asyncio.subprocess.terminate 
is called on the last subprocess when multiple subprocesses are spawned*, the 
last subprocess will never exit, and the Python interpreter will never exit. 

Spawning an instance of "TASKKILL /F" to kill the subprocess, and then awaiting 
asyncio.subprocess.wait is a workaround. Since both "TASKKILL /F" and 
asyncio.subprocess.terminate ultimately call TerminateProcess, I would expect 
the same behavior using both (without the need to wait for the subprocess to 
actually die).

I have confirmed this behavior on Python 3.5, 3.6, and 3.7 on both MSVC and 
MinGW Python (although I most frequently use the latter).

Zip file is too large, so I have a GH repo (ready to run) demonstrating this 
issue: https://github.com/cr1901/proactor

An example run looks like the following:$ python3 proactor.py
Infinite Loop, Iteration 0
Finite Loop, Iteration 0
Infinite Loop, Iteration 1
Finite Loop, Iteration 1
Infinite Loop, Iteration 2
Finite Loop, Iteration 2
Finite Loop, Iteration 3
Infinite Loop, Iteration 3
Infinite Loop, Iteration 4
Task poller finished.

The interpreter hangs after the "Task poller finished." line, which makes me 
believe that the Python interpreter is trying and failing to cleanup resources 
for some reason (IOCP never completes?).

*Each subprocess is associated with its own coroutine to handle standard output.

--
components: Windows, asyncio
messages: 346345
nosy: asvetlov, cr1901, paul.moore, steve.dower, tim.golden, yselivanov, 
zach.ware
priority: normal
severity: normal
status: open
title: Script using ProactorEventLoop does not exit cleanly on Windows with 
multiple subprocesses
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue34556] Add --upgrade to venv module

2019-06-23 Thread Cooper Lees


Cooper Lees  added the comment:

I believe so - Would love it could be included with latest 3.8 or is there no 
chance of that?

--

___
Python tracker 

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



[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-06-23 Thread Eryk Sun


Eryk Sun  added the comment:

> 1) disable _cleanup, _active, and remove _internal_poll() for windows

_active only gets appended to in __del__. We can skip the entire body of 
__del__. Also, calling _cleanup can be skipped in __init__.

_internal_poll is required for poll().

2) ignore EBADF(OSError: [WinError 6] The handle is invalid) in terminate() and 
probably some other methods

ERROR_INVALID_HANDLE should not be ignored. 

terminate() is doing the right thing by not masking ERROR_INVALID_HANDLE. The 
only concern is the case where our handle has been closed elsewhere (not by 
subprocess) and the handle value was subsequently reused as a handle for 
another process to which we have terminate access. This is a bad handle at a 
logical, application level, but it's valid and accessible for TerminateProcess. 
It was suggested to initially get the pid and process startup time in order to 
validate the call, but Alexey Izbyshev is right that it's not worth 
complicating the code in subprocess to address an uncommon bug in particular 
application or library code.

--

___
Python tracker 

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



[issue37375] Fix a code style in dictobject.c

2019-06-23 Thread hai shi


hai shi  added the comment:

Thanks, got it.

--

___
Python tracker 

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



[issue37374] Minidom does not have to escape quote inside text segments

2019-06-23 Thread Mitar


Mitar  added the comment:

FYI, this is exactly how ElementTree.tostring does it. So this would make 
ElementTree.tostring behave the same as minidom.

@dhilst: I do not think a parameter is needed here. This is completely 
compatible with HTML. It is just that currently an additional unnecessary 
escaping (for both XML in HTML context) is done.

--

___
Python tracker 

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



[issue37375] Fix a code style in dictobject.c

2019-06-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Sorry, but we usually do not accept pure cosmetic PRs.

--
nosy: +serhiy.storchaka
resolution:  -> rejected
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



[issue37379] Provide triggering AttributeError exception to __getattr__ for reraising

2019-06-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue8579] Add missing tests for FlushKey, LoadKey, and SaveKey in winreg

2019-06-23 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

@Claudiu.Popa are you still interested in working on this, If so please open a 
pull request for review.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-06-23 Thread Ruslan Kuprieiev


Ruslan Kuprieiev  added the comment:

Hi Eryk!

Thanks for a swift reply! So the current plan for fixing it is:

1) disable _cleanup, _active, and remove _internal_poll() for windows
2) ignore EBADF(OSError: [WinError 6] The handle is invalid) in terminate() and 
probably some other methods

Please let me know if I'm missing something. Also, is anyone working on this, 
or should I prepare a PR?

Thanks,
Ruslan

--

___
Python tracker 

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



[issue37379] Provide triggering AttributeError exception to __getattr__ for reraising

2019-06-23 Thread nother


nother  added the comment:

The first two exampel should produce the same result not throwing any 
exception. The third example should as it does report that prop is not 
available for instance.

The fourth example should pass on the AttributeError raised for the not 
available attr2 instead of raising a new one stating the prop2 is not available 
form instance.

In all cases the change would allow __getattr__ instead of raising a new 
AttributeError exception reraise the one triggering the  __getattr__ call

--

___
Python tracker 

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



[issue37379] Provide triggering AttributeError exception to __getattr__ for reraising

2019-06-23 Thread nother


nother  added the comment:

Ah sorry, sure. Attached some examples hope they are not too artificially 
simple to still render real world scenarios.

The one loaded was just the test that a function called from within the except 
block inside another method can use raise keyword to reraise exception caught 
by caller.

--
Added file: https://bugs.python.org/file48433/tes_attr1.py

___
Python tracker 

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



[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-06-23 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue20181] Derby #12: Convert 50 sites to Argument Clinic across 4 files

2019-06-23 Thread Zackery Spytz


Zackery Spytz  added the comment:

PR 14326 converts Modules/readline.c.

As the parser module is slated for removal in 3.9 (according to PEP 594), 
Modules/parsermodule.c should not be converted.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2019-06-23 Thread finefoot


finefoot  added the comment:

This is still an issue: 
https://stackoverflow.com/questions/56716470/python-multiprocessing-nested-shared-objects-doesnt-work-with-queue

Is there a specific reason, why https://github.com/python/cpython/pull/4819 
doesn't get reviewed?

--
nosy: +finefoot

___
Python tracker 

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



[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-06-23 Thread Eryk Sun


Eryk Sun  added the comment:

See issue 36067 for a related discussion. The _active list and _cleanup 
function are not required in Windows. When a process exits, it gets rundown to 
free its handle table and virtual memory. Only the kernel object remains, which 
is kept alive by pointer and handle references to it that can query information 
such as the exit status code. As soon as the last reference is closed, the 
Process object is automatically reaped. It doesn't have to be waited on.

--
nosy: +eryksun

___
Python tracker 

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



[issue20181] Derby #12: Convert 50 sites to Argument Clinic across 4 files

2019-06-23 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +14146
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/14326

___
Python tracker 

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



[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-06-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-06-23 Thread Ruslan Kuprieiev


New submission from Ruslan Kuprieiev :

subprocess keeps the list of active processes in its `_active` list. Whenever 
you try to Popen a new process, it is immediately (like right in the first line 
of Popen.__init__ [1]) trying to go clean up the old ones. If one of the 
processes in that list is gone, then

```
(_WaitForSingleObject(self._handle, 0)
```

[2] will get `OSError: [WinError 6] The handle is invalid` and will prevent you 
from creating any new processes with Popen after that, because the line where 
that handle is removes from _active list is not reached. On *nix [3] 
_internal_poll will actually try-except waitpid and will catch OSError without 
re-raising it, so if the process is gone, it will simply report it as dead and 
successfully remove it from _active list. It seems like we should do the same 
thing on Windows and if we catch `The handle is invalid` error, just report 
that process as dead and remove it from _active list.


[1] https://github.com/python/cpython/blob/v3.8.0b1/Lib/subprocess.py#L715

[2] https://github.com/python/cpython/blob/v3.8.0b1/Lib/subprocess.py#L1310

[3] https://github.com/python/cpython/blob/v3.8.0b1/Lib/subprocess.py#L1710

--
components: Windows
messages: 346332
nosy: Ruslan Kuprieiev, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: subprocess.Popen._cleanup() "The handle is invalid" error when some old 
process is gone
type: crash
versions: Python 3.7

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread miss-islington


miss-islington  added the comment:


New changeset 175b2e974586152c1d4cdea589b971d7ecad4d30 by Miss Islington (bot) 
in branch '3.8':
bpo-35224: Bump the pyc magic number by 1 instead of by 10 in last modification 
(GH-14320)
https://github.com/python/cpython/commit/175b2e974586152c1d4cdea589b971d7ecad4d30


--

___
Python tracker 

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



[issue37378] FatalError: initfsencoding python couldn't find codec Module not found: Encodings

2019-06-23 Thread Inada Naoki


Inada Naoki  added the comment:

There may be a broken pip.exe in your computer.

Try `python -VV` to check what python are you using.
After that, try `python -m pip`, instead of `pip`.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset b3ca7972c8d8c6479b6542ce28e0f7a6ebd5b8fe by Pablo Galindo in 
branch 'master':
bpo-35224: Bump the pyc magic number by 1 instead of by 10 in last modification 
(GH-14320)
https://github.com/python/cpython/commit/b3ca7972c8d8c6479b6542ce28e0f7a6ebd5b8fe


--

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14145
pull_request: https://github.com/python/cpython/pull/14321

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +14144
pull_request: https://github.com/python/cpython/pull/14320

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +14143
pull_request: https://github.com/python/cpython/pull/14319

___
Python tracker 

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



[issue35431] Add a function for computing binomial coefficients to the math module

2019-06-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 914d6b79735e5eabaf4e4d77e3f2ad4eae0beb9a by Serhiy Storchaka in 
branch '3.8':
[3.8] bpo-35431: Test math.comb() and math.perm() for OverflowError only on 
CPython. (GH-14146) (#14226)
https://github.com/python/cpython/commit/914d6b79735e5eabaf4e4d77e3f2ad4eae0beb9a


--

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

So issue29652 can be closed now? Was all concerns of previous discussions 
addressed?

I suggest to increment the magic number by 1, not by 10. The space of magic 
numbers is finite.

Add please a What's New entry for this change.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18299] Change script_helper to use universal_newlines=True in _assert_python

2019-06-23 Thread hai shi


Change by hai shi :


--
nosy:  -shihai1991

___
Python tracker 

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



[issue37377] unicode error should raise a value error

2019-06-23 Thread hai shi


hai shi  added the comment:

Got it, thank for your detailed explanation, steven.

--
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



[issue37379] Provide triggering AttributeError exception to __getattr__ for reraising

2019-06-23 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Could you supply a *simple* demonstration of a class showing this problem? I've 
looked at the uploaded "test6.py" (what happened to the other 5?) and don't see 
anything to do with either __getattr__ or property in it.

--
nosy: +steven.daprano
versions: +Python 3.9

___
Python tracker 

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



[issue37377] unicode error should raise a value error

2019-06-23 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

It is a *syntax* error. You have written bad syntax, just as the error message 
says. Your \xXX code is too short, only 1 hex digit instead of 2. I disagree 
that this should be a value error: it isn't a bad value, it is bad syntax.

I don't know what the context of the BDFL pronouncement in PEP 223 was, but I 
think it was decided later that Guido wrong because the error in Python 2.4 and 
2.5 was UnicodeDecodeError and then changed to SyntaxError in 2.6 (probably to 
match Python 3, I guess).

In Python 3, both unicode and bytes strings give a syntax error for this error.

--
nosy: +steven.daprano
versions: +Python 3.9

___
Python tracker 

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



[issue37379] Provide triggering AttributeError exception to __getattr__ for reraising

2019-06-23 Thread nother


New submission from nother :

Not sure where to file this suggestion properly and how.

Currently when mixing attributes and properties it can happen that an 
AttributeError not raised intentionally by @property getter can cause @property 
to vanish from from classinstance. This happens when on the class or any of its 
super classes __getattr__ method is defined and has no clue on how to handle 
attribute with name of property. In this case the latter is reported as not 
existent.

The understood purpose of this behavior is that this is the only means to 
enable @property getters to indicate the availability of the property for a 
specific class instance dependent upon local state of instance object. Another 
purpose is to implement canonical load/creation on deemand schema for 
@properties the same way as for attributes.

The down of this is that in case inside a more complex getter method an 
AttribteError is triggered unintentionally this also triggers call to 
__getattr__ whithout any means for the latter to figure whether the @property 
getter needs assistance or the error should be passed on unhandled.

Therefore i do suggest the following little change to slot_tp_getattr_hook 
method in file typeobject.c (github python/cpython master) on lines 6604 - 6607 
from

`
if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) {
PyErr_Clear();
res = call_attribute(self, getattr, name);
}
`

to 

`
if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) {
res = call_attribute(self, getattr, name);
if ( res != NULL) {
 PyErr_Clear();
}
}
`

this little change would allow __getattr__ special method to 

  1) use plain raise (see pythoncode example attached) to reraise exception 
which caused the call to it

  2) allow @property getters convey by adding custom attribute to 
AttributteExcpetion  the reason for an intentionally raised AttributeError over 
to __getattr__ allowing for distinction between AttributeError raised to hide 
@property from class instance versus triggering load/creation on demmand for 
class instance vs AttributeError accidentially triggered by 
getter/setter/deleter code.


Still not possible would be for getattr and hasattr methods to figure whether 
the AttributeError is raised cause class instance does not have the requested 
attirbute or whether accessing the attribute or @property respekctive caused 
some there downstream an AttributeError. In case that would be reliably 
feasible at all.

--
components: Interpreter Core
files: test6.py
messages: 346323
nosy: nother
priority: normal
severity: normal
status: open
title: Provide triggering AttributeError exception to __getattr__ for reraising
type: enhancement
Added file: https://bugs.python.org/file48432/test6.py

___
Python tracker 

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



[issue37378] FatalError: initfsencoding python couldn't find codec Module not found: Encodings

2019-06-23 Thread Lokesh Chandak


New submission from Lokesh Chandak :

I encountered this issue when using pip. Whenever I try to install a package, 
it shows a Fatal error, saying that the module encodings was not found, 
followed by a reboot.
The blue screen shows this message:
KMode exception not handled.
What failed: dipsp.sys.

I have tried uninstalling and reinstalling python 3.7.3. I have also tried 
moving back to Python 3.5, because I am certain that this issue didn't exist 
when I was using that. However I encountered the same issues again.

I can otherwise use the interpreter, and run all my code just fine. Previously 
installed modules like pandas and numpy also work like usual. The only 
difficulty I encountered is when attempting to install new packages using pip.

After looking around, I found something about setting PYTHONPATH and PYTHONHOME 
environment variables, but it didn't work either.
I tried installing python in different locations, but that didn't help either.

I am now stuck because I can't install any modules, (and I lost previously 
installed modules during clean reinstall).
How do I solve this? And while a solution is found, is there a way to install 
modules without pip?

--
components: Installation, Windows
messages: 346322
nosy: Lokesh Chandak, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: FatalError: initfsencoding python couldn't find codec Module not found: 
Encodings
type: crash
versions: Python 3.7

___
Python tracker 

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



[issue37377] unicode error should raise a value error

2019-06-23 Thread hai shi


New submission from hai shi :

>>> "\x1"
  File "", line 1
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in 
position 0-2: truncated \xXX escape

I think rasing the valueError would be exact.(pep223 agree this behavior: 
https://www.python.org/dev/peps/pep-0223/#bdfl-pronouncements).

And I think the error type could be changed in:
https://github.com/python/cpython/blob/master/Python/ast.c#L682

--
components: Interpreter Core
messages: 346321
nosy: shihai1991
priority: normal
severity: normal
status: open
title: unicode error should raise a value error
type: behavior

___
Python tracker 

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



[issue32934] logging.handlers.BufferingHandler capacity is unclearly specified

2019-06-23 Thread Enrico Zini


Enrico Zini  added the comment:

Thanks! Clarifying "number of records buffered" would perfectly solve the 
problem for me.

--

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

All buildbots for 3.8 and master are green again :)

--

___
Python tracker 

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



[issue37376] pprint for types.SimpleNamespace

2019-06-23 Thread Carl Bordum Hansen


Change by Carl Bordum Hansen :


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

___
Python tracker 

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



[issue37376] pprint for types.SimpleNamespace

2019-06-23 Thread Carl Bordum Hansen


New submission from Carl Bordum Hansen :

Currently, pprint.pprint does not help you at all when pretty-printing 
SimpleNamespaces. I have implemented support for this.

--
components: Library (Lib)
messages: 346318
nosy: carlbordum, fdrake, serhiy.storchaka
priority: normal
severity: normal
status: open
title: pprint for types.SimpleNamespace
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue35181] Doc: Namespace Packages: Inconsistent documentation of __loader__ being None

2019-06-23 Thread Géry

Géry  added the comment:

Oops, sorry, only one of the two PRs has been merged.

--

___
Python tracker 

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



[issue35181] Doc: Namespace Packages: Inconsistent documentation of __loader__ being None

2019-06-23 Thread Géry

Géry  added the comment:

@Julien, @Barry

Now that the PRs are merged, I think that we can close this issue.

--

___
Python tracker 

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



[issue37373] Configuration of windows event loop for libraries

2019-06-23 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

I doubt if we should split a proactor loop into two objects in two threads.
I see no strong objections but have a feeling that we'll get other problems in 
this way. asyncio is just not designed for this mode.

The proposal looks like a very dirty hack and smells as it is.
There is no very strong reason to apply it. 
Jupiter Notebook can fix the problem on its own side in two-three lines of 
clear code.

--

___
Python tracker 

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



[issue37375] Fix a code style in dictobject.c

2019-06-23 Thread hai shi


New submission from hai shi :

# A small code style question: PyDictObject*mp should add a space:)
PyDictObject *mp = (PyDictObject *)op

--

___
Python tracker 

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



[issue37375] Fix a code style in dictobject.c

2019-06-23 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue37375] Fix a code style in dictobject.c

2019-06-23 Thread hai shi


Change by hai shi :


--
components: Interpreter Core
nosy: shihai1991
priority: normal
severity: normal
status: open
title: Fix a code style in dictobject.c

___
Python tracker 

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