[issue37226] Asyncio Fatal Error on SSL Transport - IndexError Deque Index Out Of Range

2019-12-11 Thread Ben Brown


Change by Ben Brown :


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



[issue38614] test_asyncio: test_communicate() failed on AMD64 FreeBSD Shared 3.8

2019-12-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0d63bacefd2e5b937ec6b0ec3053777c09941b4a by Victor Stinner in 
branch 'master':
bpo-38614: Use test.support.SHORT_TIMEOUT constant (GH-17566)
https://github.com/python/cpython/commit/0d63bacefd2e5b937ec6b0ec3053777c09941b4a


--

___
Python tracker 

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



[issue38614] test_asyncio: test_communicate() failed on AMD64 FreeBSD Shared 3.8

2019-12-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17046
pull_request: https://github.com/python/cpython/pull/17572

___
Python tracker 

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



[issue39025] Windows Python Launcher does not update PATH to Scripts directory

2019-12-11 Thread Bluebird


New submission from Bluebird :

The py Python launcher is a great improvement over a few years ago when 
managing multiple Python installation was tedious.

However, it does not solve one annoying problem: the Scripts directory. If you 
install tools like mypy, pyqt-tools or pyinstaller, to be able to use them, you 
need to have the Scripts directory in your PATH variable. And if you have 
multiple Python installations, you are back to square 1 where you have to 
explicitely modify your PATH according to the version of Python where the tools 
have been installed.

To give a practical example, at work, I have Python 3.1 because some of our 
software are distributed as .pyc for this version of Python, Python 3.5 for the 
same reason and Python 3.7 for all the developments which do not incur the 
previous dependencies.

The default environement with Python and Python\Scripts added to the path is 
Python 3.5 . However, for all PyQt developments, I use Python 3.7 . I launch my 
program with py -3.7 myfancygui.py  but when I want to access some of the pyqt 
tools like pyuic5, I need to explicitely add Python3.7\Scripts to my PATH.

The technical solution is not clear to me, but it would be nice to duplicate 
the benefits of the py launcher to the Scripts directory.

Some random propositions:

1. Create a pyscript launcher, which would work like py but would take as 
command-line the name of the script to run:

pyscript -3.7 pyuic5

2. Let py execute a command-line with proper environment for that specific 
version of python:

   > py -env-3.7
   Environment adjusted for Python 3.7
   > pyuic5 ... works fine
   > exit
   Back to default environement

There are probably other stratagic ways to reach the same result.

--
components: Windows
messages: 358256
nosy: bluebird, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Windows Python Launcher does not update PATH to Scripts directory
type: enhancement
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



[issue28866] Type cache is not correctly invalidated on a class defining mro()

2019-12-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

A refcount problem possibly caused by the fix: 
https://bugs.python.org/issue39016

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue28866] Type cache is not correctly invalidated on a class defining mro()

2019-12-11 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +17047
pull_request: https://github.com/python/cpython/pull/17573

___
Python tracker 

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



[issue28866] Type cache is not correctly invalidated on a class defining mro()

2019-12-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

Steve, I would like to add your reproducer (weird.py) to CPython's test suite, 
to make sure this doesn't happen again.

Would you be willing to sign the contributor agreement, so we can use your code 
in Python?

The instructions are here: https://www.python.org/psf/contrib/contrib-form/

--

___
Python tracker 

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



[issue39025] Windows Python Launcher does not update PATH to Scripts directory

2019-12-11 Thread Paul Moore


Paul Moore  added the comment:

Most items in the Scripts directory can be run using the `-m` flag to Python, 
so you can use something like `py -m pip` to run pip without needing the 
Scripts directory in PATH.

If an individual project like PyQt doesn't support -m, it's relatively easy for 
them to add, so it might be worth suggesting to them.

--

___
Python tracker 

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



[issue39016] Negative Refcount in Python 3.8

2019-12-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

lookup_maybe_method should not return a borrowed reference. It increfs its 
return value.

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue1021318] PyThreadState_Next not thread safe

2019-12-11 Thread Julien Danjou


Julien Danjou  added the comment:

Victor, do you have an idea of how you would like this mutex to be exposed?

I see it only recently changed in Python 3.7 to be part of a structure, though 
this structure is not public AFAIU.

Is adding 2 new lock/unlock C functions good enough?

--

___
Python tracker 

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2019-12-11 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-1021318: "PyThreadState_Next not thread safe".

--

___
Python tracker 

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



[issue1021318] PyThreadState_Next not thread safe

2019-12-11 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not sure of what is the best approach. Currently, bpo-10915 is blocking 
different projects: "Make the PyGILState API compatible with multiple 
interpreters". We may have to fix this API first, and clarify the scope of the 
different locks.

--

___
Python tracker 

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



[issue39025] Windows Python Launcher does not update PATH to Scripts directory

2019-12-11 Thread Bluebird


Bluebird  added the comment:

Thanks for the quick feedback.

I agree that it makes sense for python modules to support -m. However, PyQt 
comes with many executables originally written in C++ for Qt (designer, 
assistant). It feels a bit strange to add a module with that name, just for the 
purpose of creating a -m target so that you can run it without Scripts in path.

Moreover, some of these C++ exectuables depends on DLL which are only in the 
Scripts directory and it might not work. I do not think that your proposal 
addresses the full problem.

--

___
Python tracker 

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



[issue38860] GenericPyCData_new does not invoke new or init

2019-12-11 Thread Lewis Gaul


Change by Lewis Gaul :


--
nosy: +LewisGaul, aeros

___
Python tracker 

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



[issue38860] GenericPyCData_new does not invoke new or init

2019-12-11 Thread Rebecca Morgan


Rebecca Morgan  added the comment:

Looking at the test case 'test_from_buffer_copy' here:
https://github.com/python/cpython/blob/master/Lib/ctypes/test/test_frombuffer.py

This suggests the failure to call init in this instance is expected behavior 
(similarly for from_buffer), unlike e.g. the classmethod fromkeys() with a 
dictionary subclass which behaves as expected.

Are there any required changes here, perhaps if not code then documentation?

--

___
Python tracker 

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



[issue39026] pystate.h contains non-relative of initconfig.h include causing macOS Framework include failure

2019-12-11 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue39026] pystate.h contains non-relative of initconfig.h include causing macOS Framework include failure

2019-12-11 Thread Gaige Paulsen


New submission from Gaige Paulsen :

The cpython/pystate.h includes cpython/initconfig.h using the relative path 
"cpython/initconfig.h", which probably works fine if your include path 
explicitly contains the top of the python directory, however when developing 
with a framework in macOS, the framework's root path cannot be referred to 
relatively.

Since cpython/pystate.h and cpython/initconfig.h live in the same directory, 
any C compiler should include them correctly, regardless of include path if the 
cpython/pystate.h includes "initconfig.h" instead of "cpython/initconfig.h", 
since I believe the very first path is always relative to the file including 
the next file.  In this case, cpython is the parent of pystate.h and thus 
including initconfig.h directly should work fine.

Previous 3.x versions worked fine, but the cpython directory wasn't in Headers 
for macOS.

Although I wasn't able to exhaustively test this on all platforms and with all 
compilers, changing the include in cpython/pystate.h to "initconfig.h" solved 
the compilation/include problem.

--
components: C API, macOS
messages: 358266
nosy: gaige, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: pystate.h contains non-relative of initconfig.h include causing macOS 
Framework include failure
type: behavior
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



[issue39026] pystate.h contains non-relative of initconfig.h include causing macOS Framework include failure

2019-12-11 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

In what way does it not work when using a framework build? Is this when you add 
the python framework to an (Xcode) project and include the main python header 
using "#include "?

--

___
Python tracker 

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



[issue39016] Negative Refcount in Python 3.8

2019-12-11 Thread Christian Tismer


Christian Tismer  added the comment:

On 11.12.19 14:13, Petr Viktorin wrote:
> 
> Petr Viktorin  added the comment:
> 
> lookup_maybe_method should not return a borrowed reference. It increfs its 
> return value.

At second sight, this seems to be true. No idea why I
was so convinced. Need to sleep and look again..

--

___
Python tracker 

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



[issue39026] pystate.h contains non-relative of initconfig.h include causing macOS Framework include failure

2019-12-11 Thread Gaige Paulsen


Gaige Paulsen  added the comment:

I should have been more specific. Sorry about that.

Yes, when including  in Xcode, incorporating the framework. In 
particular, I'm embedding 3.8 in an application (previously used the system 
Framework, which was 2.7, which worked but Apple has warned that it may 
disappear).  

The Xcode error is:

In file included from /Users/gaige/MyApp/Code/PythonImporter.m:10:
In file included from ../python-framework/Python.framework/Headers/Python.h:121:
In file included from 
../python-framework/Python.framework/Headers/genobject.h:11:
In file included from 
../python-framework/Python.framework/Headers/pystate.h:129:
../python-framework/Python.framework/Headers/cpython/pystate.h:10:10: fatal 
error: 'cpython/initconfig.h' file not found
#include "cpython/initconfig.h"
 ^~
1 error generated.

python-framework is in the framework search path.

Let me know if there's something further I can clarify.

--

___
Python tracker 

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



[issue1438480] shutil.move raises OSError when copystat fails

2019-12-11 Thread Eshan Singhal


Eshan Singhal  added the comment:

Amending shutil.copy and shutil.copy2 to expose a method of ignoring the 
permission errors rather than changing the current behaviour would not fix the 
original issue without further changes in consumers of these functions to pass 
through the new parameter (i.e. shutil.move in this scenario).

This may be undesirable as copy_function is an optional parameter to 
shutil.move and so there would have to be a specialcase guard/check to see if 
the copy_function is shutil.copy or shutil.copy2 when passing in a new 
ignore_permission_errors parameter.

I propose a new issue to track adding functionality to optionally ignore 
permission issues for shutil.copy/shutil.copy2, and this issue can remain open.

--
nosy: +eshan-singhal

___
Python tracker 

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



[issue39016] Negative Refcount in Python 3.8

2019-12-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

The goal now should be to find a reasonably small reproducer.

I'm trying to compile PySide to see what it does, but it's a big project and 
I'm a bit lost.
Christian, you said in an e-mail that you have a workaround -- unsetting the 
Py_TPFLAGS_METHOD_DESCRIPTOR. Could you point me to the commit with that 
workaround, so I could try exploring the code in context?

--

___
Python tracker 

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



[issue1021318] PyThreadState_Next not thread safe

2019-12-11 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue39025] Windows Python Launcher does not update PATH to Scripts directory

2019-12-11 Thread Steve Dower


Steve Dower  added the comment:

> Moreover, some of these C++ exectuables depends on DLL which are only in the 
> Scripts directory and it might not work.

In this case, perhaps these tools should be in a separate directory? A simple 
.py script could be added to Scripts that works with "-m" and launches the 
executable.

> I do not think that your proposal addresses the full problem.

You'll have to excuse us. We've had a lot of experience in this area with this 
problem, and so we'll be very quick to rule out imaginary proposals like the 
one you posted that we know are technically infeasible.

--

___
Python tracker 

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



[issue39025] Windows Python Launcher does not update PATH to Scripts directory

2019-12-11 Thread Steve Dower


Steve Dower  added the comment:

> Create a pyscript launcher, which would work like py but would take as 
> command-line the name of the script to run ...

This is spelled "py [-x.y] -m [script]", but it's up to the libraries to 
support it. We can't force them to do it.

> Let py execute a command-line with proper environment for that specific 
> version of python

"Proper environment" is a matter of opinion, as evidenced by hundreds of issues 
that arise every time people try to get clever here.

And %PATH% on Windows is a system setting that has an impact on every 
application that launches, and also has different behaviour on different 
version of the OS (because it's a system setting, so the system can change how 
it uses that setting over time).

Perhaps what you want is a virtual environment? Then your activate command is 
spelled "activate" and your exit command is spelled "deactivate". These have 
some of the issues I hinted at, as well as many of their own, but at least they 
already exist and are in widespread use, so most libraries are going to avoid 
relying on things that don't work. Inventing a new approach here would create 
and entirely new set of things that don't work, and it'll take the ecosystem 
years to catch up (and many won't even care to try until there's critical mass 
usage of the new approach, which won't happen until the ecosystem catches up, 
etc. etc.)

--

___
Python tracker 

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



[issue36225] Lingering subinterpreters should be implicitly cleared on shutdown

2019-12-11 Thread Lewis Gaul


Change by Lewis Gaul :


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

___
Python tracker 

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



[issue39016] Negative Refcount in Python 3.8

2019-12-11 Thread Christian Tismer


Christian Tismer  added the comment:

On 11.12.19 17:37, Petr Viktorin wrote:
> 
> Petr Viktorin  added the comment:
> 
> The goal now should be to find a reasonably small reproducer.
> 
> I'm trying to compile PySide to see what it does, but it's a big project and 
> I'm a bit lost.
> Christian, you said in an e-mail that you have a workaround -- unsetting the 
> Py_TPFLAGS_METHOD_DESCRIPTOR. Could you point me to the commit with that 
> workaround, so I could try exploring the code in context?

Yes, it went into gerrit here:

https://codereview.qt-project.org/c/pyside/pyside-setup/+/282705

The problem is that during PySide type creation the PyType_Ready
function looks into the mro() method, which uses this new
flag. When I temporary remove that, everything works.

Cheers -- Chris

--

___
Python tracker 

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



[issue39016] Negative Refcount in Python 3.8

2019-12-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

Thanks!

(note: unfortunately I'll probably not have time for CPython until next week, 
but further investigation is on my list.)

--

___
Python tracker 

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



[issue28254] Add C API for gc.enable, gc.disable, and gc.isenabled

2019-12-11 Thread Gregory P. Smith


Change by Gregory P. Smith :


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



[issue38860] GenericPyCData_new does not invoke new or init

2019-12-11 Thread Justin Capella


Justin Capella  added the comment:

It might make sense that CSimpleData types do not call init, which makes sense 
for _fields_ but it doesn't make sense to offer subclassing (of Structure) and 
not use the subclass, instead creating a type of the same name.

That test case is bugged, missing an underscore... The git blame wasn't 
"available" for that particular test but I would argue that it's testing for 
undocumented behavior :p

I wanted to be able to do assertions/initialization, I'm sure other people have 
expected from_buffer(_copy) et al would act as a class method, returning an 
instance of the subclass.

More generally, I think that GenericPyCData_new should not "tp_alloc"... What's 
_new about that?

My guess is there was at some level desire to "optimize" ctypes. If that does 
turn out to be the case I'd hope for a "unsimple" CData and ask that Structure 
be an instance of that.

Either way docs reflecting the behavior to Structure would be nice, I just hope 
it includes "prior to version" :p thanks for taking a look

--

___
Python tracker 

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



[issue38999] Python launcher on Windows does not detect active venv

2019-12-11 Thread Alexandros Karypidis


Alexandros Karypidis  added the comment:

My suggestion to gradually fall back from most specific to least specific 
version, was an attempt to reconcile the input from various viewpoints.

I think that ideally the behaviour should be as close to UNIX as possible. This 
means that it should just search the path for that binary (which is the whole 
point of using /usr/bin/env) and use it (even if it is the wrong version).

While I understand that one can do more (verify the version in whatever 
executable is located, etc) there is a lot in favor of consistency across 
platforms (versus even better behavior).

So my vote if the community decides to address this would be to just "search 
the path for .exe when encountering #!/usr/bin/env " and 
then launch it and hope for the best.

This makes it simple for users to intervene via the PATH (which is the whole 
point of /usr/bin/env) and launch whatever they want. 

Currently, creatign a venv on windows only places "python.exe" in the Scripts 
folder (another difference to Linux). I would argue this is "correct" though 
because I think this was a decision of DISTROS (to use python for version 2 and 
python3 for version 3, while undertransition). Most distros still do that to 
this day and it will likely stick around. One day there will be only "python" 
and it will mean "version 3" but until then, it's better for the py launcher to 
do the same as on Linux and say "could not find python3 in the path" where the 
user can intervene (e.g. copy python.exe as python3.exe) and "fix" it manually.

Of course, doing "smarter" things on Windows is always an option but I would 
say that at least the "minimal" should be done to support consistency. (As I 
said, I would also suggest that no more than this minimal be done, but not in 
order to keep implementation simple, but to keep it consistent with other 
platforms).

Then again, that's merely one point of view from someone who is a user and does 
not even contribute to the project...

--

___
Python tracker 

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



[issue33762] Make tempfiles subclass IOBase

2019-12-11 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Looking at the tempfile code more, I agree with Serhiy that changing it should 
be rejected.  Python is a duck-typed language (essentially what Martin said). 
People should not be over-zealous in using instance checks.
 
The doc specifically says that TemporaryFile returns a *file-like object*
https://docs.python.org/3/glossary.html#term-file-like-object
which only require implementing the interface.

--
resolution:  -> rejected
stage: test needed -> 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



[issue38614] test_asyncio: test_communicate() failed on AMD64 FreeBSD Shared 3.8

2019-12-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7772b1af5ebc9d72d0cfc8332aea6b2143eafa27 by Victor Stinner in 
branch 'master':
bpo-38614: Use support timeout constants (GH-17572)
https://github.com/python/cpython/commit/7772b1af5ebc9d72d0cfc8332aea6b2143eafa27


--

___
Python tracker 

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



[issue38614] Add timeout constants to test.support

2019-12-11 Thread STINNER Victor


Change by STINNER Victor :


--
title: test_asyncio: test_communicate() failed on AMD64 FreeBSD Shared 3.8 -> 
Add timeout constants to test.support

___
Python tracker 

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



[issue38614] Add timeout constants to test.support

2019-12-11 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not sure about backporting the new timeout constants of test.support to 
Python 3.7 and 3.8. Backporting all changes may help to make tests more stable 
in 3.7 and 3.7 branches. It should also help to backport test changes from 
master to 3.7 and 3.8. But it's somehow a new feature and so I suggest to not 
backport yet.

I may backport later if they are too many conflicts or if tests fail too often 
because of too short timeouts.

I close the issue.

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



[issue39027] run_coroutine_threadsafe uses wrong TimeoutError

2019-12-11 Thread janust


New submission from janust :

https://docs.python.org/3.8/library/asyncio-task.html#asyncio.run_coroutine_threadsafe
 has a code example that catches a asyncio.TimeoutError from 
run_coroutine_threadsafe. In Python 3.7, this exception was equal to 
concurrent.futures.TimeoutError, but since 
https://github.com/python/cpython/commit/431b540bf79f0982559b1b0e420b1b085f667bb7
 that is not the case anymore.

--
assignee: docs@python
components: Documentation
messages: 358281
nosy: docs@python, janust
priority: normal
severity: normal
status: open
title: run_coroutine_threadsafe uses wrong TimeoutError
versions: Python 3.8, Python 3.9

___
Python tracker 

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



[issue38999] Python launcher on Windows does not detect active venv

2019-12-11 Thread Steve Dower


Steve Dower  added the comment:

> This makes it simple for users to intervene via the PATH (which is the whole 
> point of /usr/bin/env) and launch whatever they want.

That's one point of view, but the other is that the whole point of the shebang 
line is for users to be able to run the script without having to use a terminal 
at all. And once you're there, you no longer have a customisable PATH to work 
with.

"Simple for users to intervene via the PATH" is not true on Windows. Modifying 
PATH globally can break applications or (some) system components, and modifying 
it temporarily requires becoming a terminal user, which is not the majority.

Personally, I think supporting the shebang line in py.exe is a misfeature and 
would prefer we'd never done it (though it predates my involvement). But if 
someone wants to implement support for detecting a venv and matching it to the 
shebang, I won't actively block it going in.

--

___
Python tracker 

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



[issue39001] possible problem with 64-bit mingw DECREF

2019-12-11 Thread Dave Lawrence


Dave Lawrence  added the comment:

by redefinining the Py_DECREF macro in my application:

#define  Py_DECREF(op) do { if (--op->ob_refcnt == 0) fprintf(stderr, "DECREF 
%s %d %p %d %s %p\n", __FILE__, __LINE__, op, Py_SIZE(op), 
Py_TYPE(op)->tp_name,Py_TYPE(op)->tp_dealloc );  fflush(stderr); } while(0)

this outputs lines like this:

DECREF vardef_file.cc 1601 09F3C728 0 generator 

which appears to be showing the tp_dealloc is a null pointer.

--

___
Python tracker 

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



[issue39016] Negative Refcount in Python 3.8

2019-12-11 Thread Christian Tismer


Christian Tismer  added the comment:

Sorry, I believe I was wrong and lookup_maybe_method does not return a borrowed 
reference. _PyType_Lookup does and I was confused.
Closing that for now.

--

___
Python tracker 

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



[issue39016] Negative Refcount in Python 3.8

2019-12-11 Thread Christian Tismer


Change by Christian Tismer :


--
stage: patch review -> resolved

___
Python tracker 

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



[issue39016] Negative Refcount in Python 3.8

2019-12-11 Thread Christian Tismer


Change by Christian Tismer :


--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue39001] possible problem with 64-bit mingw DECREF

2019-12-11 Thread Dave Lawrence


Dave Lawrence  added the comment:

traced to be a duplicate of https://bugs.python.org/issue28267

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



[issue38921] Max Recursion Depth Reached in Logging Library

2019-12-11 Thread Joy


Joy  added the comment:

Yes, still working on a script for this bug.

--
status: pending -> open

___
Python tracker 

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



[issue39028] ENH: Fix performance issue in keyword extraction

2019-12-11 Thread Sebastian Berg


New submission from Sebastian Berg :

The keyword argument extraction/finding function seems to have a performance 
bug/enhancement (unless I am missing something here). It reads:


```
for (i=0; i < nkwargs; i++) {
PyObject *kwname = PyTuple_GET_ITEM(kwnames, i);

/* ptr==ptr should match in most cases since keyword keys
   should be interned strings */
if (kwname == key) {
return kwstack[i];
}
assert(PyUnicode_Check(kwname));
if (_PyUnicode_EQ(kwname, key)) {
return kwstack[i];
}
}
```

However, it should be split into two separate for loops, using the 
`PyUnicode_EQ` check only if it failed for _all_ other arguments.

I will open a PR for this (it seemed like a bpo number is wanted for almost 
everything.

--
components: C API
messages: 358287
nosy: seberg
priority: normal
severity: normal
status: open
title: ENH: Fix performance issue in keyword extraction
versions: Python 3.8, Python 3.9

___
Python tracker 

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



[issue39028] ENH: Fix performance issue in keyword extraction

2019-12-11 Thread Sebastian Berg


Change by Sebastian Berg :


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

___
Python tracker 

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



[issue37701] shutil.copyfile raises SpecialFileError for symlink to fifo

2019-12-11 Thread Ashley Whetter


Change by Ashley Whetter :


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

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-12-11 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

The fix seems to generate few DeprecationWarning while running test suite with 
-Wall.

➜  cpython git:(master) git checkout ab513a38c98695f271e448fe2cb7c5e39eef~1 
Lib/asyncio
Updated 1 path from 4fb4056fbc
➜  cpython git:(master) ✗ ./python.exe -Wall -m test test_asyncio -m 
test_create_datagram_endpoint_nosoreuseport -m 
test_create_datagram_endpoint_ip_addr
0:00:00 load avg: 3.12 Run tests sequentially
0:00:00 load avg: 3.12 [1/1] test_asyncio

== Tests result: SUCCESS ==

1 test OK.

Total duration: 133 ms
Tests result: SUCCESS

➜  cpython git:(master) ✗ git checkout ab513a38c98695f271e448fe2cb7c5e39eef 
Lib/asyncio
Updated 1 path from 63d1437ba5
➜  cpython git:(master) ./python.exe -Wall -m test test_asyncio -m 
test_create_datagram_endpoint_nosoreuseport -m 
test_create_datagram_endpoint_ip_addr
0:00:00 load avg: 3.03 Run tests sequentially
0:00:00 load avg: 3.03 [1/1] test_asyncio
/Users/kasingar/stuff/python/cpython/Lib/asyncio/events.py:81: 
DeprecationWarning: The *reuse_address* parameter has been deprecated as of 
3.5.10 and is scheduled for removal in 3.11.
  self._context.run(self._callback, *self._args)
/Users/kasingar/stuff/python/cpython/Lib/asyncio/events.py:81: 
DeprecationWarning: The *reuse_address* parameter has been deprecated as of 
3.5.10 and is scheduled for removal in 3.11.
  self._context.run(self._callback, *self._args)

== Tests result: SUCCESS ==

1 test OK.

Total duration: 135 ms
Tests result: SUCCESS

--
nosy: +xtreak

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-12-11 Thread Kyle Stanley


Kyle Stanley  added the comment:

> The fix seems to generate few DeprecationWarning while running test suite 
> with -Wall.

Thanks Karthikeyan, I'm guessing that I missed an assertWarns() or left an 
outdated test somewhere that explicitly sets `reuse_address=False` (since 
`reuse_address=True` would raise a ValueError instead of a DeprecationWarning). 
I'll do some investigation and fix the issue as soon as possible.

--

___
Python tracker 

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



[issue36054] On Linux, os.count() should read cgroup cpu.shares and cpu.cfs (CPU count inside docker container)

2019-12-11 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue39028] ENH: Fix performance issue in keyword extraction

2019-12-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Could you please provide benchmarks which demonstrate the performance issue?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-12-11 Thread Kyle Stanley


Kyle Stanley  added the comment:

> or left an outdated test somewhere that explicitly sets `reuse_address=False`

Looks like this was the issue, I left a `reuse_address=False` in both 
test_create_datagram_endpoint_nosoreuseport and 
test_create_datagram_endpoint_ip_addr. I fixed it locally on the latest commit 
to master:

[aeros:~/repos/cpython]$ ./python -Wall -m test test_asyncio -m 
test_create_datagram_endpoint_nosoreuseport -m 
test_create_datagram_endpoint_ip_addr 
0:00:00 load avg: 0.29 Run tests sequentially
0:00:00 load avg: 0.29 [1/1] test_asyncio

== Tests result: SUCCESS ==

1 test OK.

Total duration: 130 ms
Tests result: SUCCESS

I also used git grep to ensure `reuse_address=False` didn't exist at any other 
locations, other than the intentional one to test the DeprecationWarning.

But while doing that, I did notice that `reuse_address=` is present in several 
other locations through Lib/asyncio, which will likely add some confusing 
deprecation warnings to anyone running their asyncio programs with -Wall. The 
way we did the deprecation was using an _unset sentinel, so even 
`reuse_address=None` will cause a DeprecationWarning (since the parameter will 
be removed entirely in 3.11).

I'll fix them accordingly and open a new PR (as well as the backports).

--

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-12-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

One more resource warning about unclosed resource being garbage collected. As 
per the other tests I think transport and protocol need to be closed as per 
below patch but someone can verify if it's the right approach.

./python.exe -X tracemalloc -Wall -m test test_asyncio -m 
test_create_datagram_endpoint_reuse_address_warning
0:00:00 load avg: 2.45 Run tests sequentially
0:00:00 load avg: 2.45 [1/1] test_asyncio
/Users/kasingar/stuff/python/cpython/Lib/test/support/__init__.py:1722: 
ResourceWarning: unclosed 
  gc.collect()
Object allocated at (most recent call last):
  File "/Users/kasingar/stuff/python/cpython/Lib/asyncio/base_events.py", 
lineno 1331
sock = socket.socket(
/Users/kasingar/stuff/python/cpython/Lib/asyncio/selector_events.py:694: 
ResourceWarning: unclosed transport <_SelectorDatagramTransport fd=6>
  _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
Object allocated at (most recent call last):
  File "/Users/kasingar/stuff/python/cpython/Lib/asyncio/selector_events.py", 
lineno 84
return _SelectorDatagramTransport(self, sock, protocol,

== Tests result: SUCCESS ==

1 test OK.

Total duration: 373 ms
Tests result: SUCCESS

diff --git Lib/test/test_asyncio/test_base_events.py 
Lib/test/test_asyncio/test_base_events.py
index 6c0f00dc93..338f35c8dd 100644
--- Lib/test/test_asyncio/test_base_events.py
+++ Lib/test/test_asyncio/test_base_events.py
@@ -1814,7 +1814,9 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
 reuse_address=False)

 with self.assertWarns(DeprecationWarning):
-self.loop.run_until_complete(coro)
+transport, protocol = self.loop.run_until_complete(coro)
+transport.close()
+self.loop.run_until_complete(protocol.done)

 @patch_socket
 def test_create_datagram_endpoint_nosoreuseport(self, m_socket):

After patch there are no resource warnings for the test.

./python.exe -X tracemalloc -Wall -m test test_asyncio -m 
test_create_datagram_endpoint_reuse_address_warning
0:00:00 load avg: 2.09 Run tests sequentially
0:00:00 load avg: 2.09 [1/1] test_asyncio

== Tests result: SUCCESS ==

1 test OK.

Total duration: 349 ms
Tests result: SUCCESS

--

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-12-11 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-12-11 Thread Kyle Stanley


Kyle Stanley  added the comment:

> I'll fix them accordingly and open a new PR (as well as the backports).

Nevermind. Upon further inspection, the other occurrences of `reuse_address=` 
were for create_server(), not create_datagram_endpoint(). The PR will only 
include the removal of the two occurrences of `reuse_address=False` in 
Lib/test/test_asyncio/test_base_events.py. Fortunately, this _should_ mean that 
the `needs backport to x` labels and automated backports from miss-islington 
will work correctly, since the changes are rather minimal. 

Thanks again for pointing it out Karthikeyan, as well as mentioning the 
specific tests the DeprecationWarnings were coming from. That made it a lot 
easier to figure out the source of the warnings.

--

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-12-11 Thread Kyle Stanley


Kyle Stanley  added the comment:

> One more resource warning about unclosed resource being garbage collected. As 
> per the other tests I think transport and protocol need to be closed as per 
> below patch but someone can verify if it's the right approach.

Ah, good catch. It's not needed when the ValueError occurs because it prevents 
the transport and protocol from being created in the first place, but I forgot 
that it would still be needed for the DeprecationWarning test. In addition to 
your changes, I'll also add a self.assertEqual('CLOSED', protocol.state). This 
is done in most of the other tests and it doesn't hurt to make sure the 
protocol properly closed.

I'll add your fix to the PR and add you to the "Co-authored-by" for that 
commit, thanks.

--

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-12-11 Thread Kyle Stanley


Change by Kyle Stanley :


--
pull_requests: +17051
pull_request: https://github.com/python/cpython/pull/17577

___
Python tracker 

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