[issue1564508] RFC 2965 BaseCookie does not support "$Port"

2019-04-24 Thread Martin Panter

Martin Panter  added the comment:

The original report comes from . 
Anders was trying to parse a HTTP request Cookie field, something like:

BaseCookie('sessionid=a2be2e7debe71af8d88d350c4d14d768;$Path=/;$Domain=192.168.0.2;$Port="8000"')

The problem is that Cookie.py assumes names beginning with a dollar sign ($) 
are reserved attributes of a previous cookie-pair, rather than arbitrary cookie 
names. It is obvious that this was intended to support RFC 2965, although it is 
not documented. The module has a hard-coded list of reserved attribute names, 
and Port is not one of them.

IMO it would be better to treat (unknown) reserved attributes such as $Port as 
ordinary cookie names, and start a new “morsel”. Ignoring them would also be a 
better option than rejecting the whole cookie field. The dollar sign is valid 
for a cookie name (token) according to RFC 2109, RFC 6265, and the Netscape 
specification.

--
nosy: +martin.panter

___
Python tracker 

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



[issue36654] Add example to tokenize.tokenize

2019-04-24 Thread Windson Yang


Change by Windson Yang :


--
keywords: +patch
pull_requests: +12871
stage:  -> patch review

___
Python tracker 

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



[issue36654] Add example to tokenize.tokenize

2019-04-24 Thread Windson Yang


Windson Yang  added the comment:

Yes, I can make a PR for it.

--

___
Python tracker 

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



[issue23930] http.cookies.SimpleCookie doesn't parse comma-only separated cookies correctly

2019-04-24 Thread Martin Panter


Change by Martin Panter :


--
resolution:  -> rejected
status: open -> pending

___
Python tracker 

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



[issue36715] Dictionary initialization

2019-04-24 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



[issue21536] extension built with a shared python cannot be loaded with a static python

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:

With an additonal change on SOABI (I will open a separated issue for that), PR 
12946 allows to load lxml built in release mode in a Python built in debug 
mode! That's *very* useful for debugging: see my gdb example below.

---

I just modified the ABI of debug build so release and debug build now have the 
same ABI: bpo-36465.

I wrote a patch to use the same sys.implementation.cache_tag (SOABI) in release 
and debug mode:

diff --git a/configure b/configure
index b02d17c053..38eb7f1bd6 100755
--- a/configure
+++ b/configure
@@ -6325,7 +6325,6 @@ $as_echo "#define Py_DEBUG 1" >>confdefs.h
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; };
   Py_DEBUG='true'
-  ABIFLAGS="${ABIFLAGS}d"
 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }; Py_DEBUG='false'
 fi
diff --git a/configure.ac b/configure.ac
index 65d3f8e691..1b2cd3076c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1223,7 +1223,6 @@ then
   [Define if you want to build an interpreter with many run-time checks.])
   AC_MSG_RESULT(yes);
   Py_DEBUG='true'
-  ABIFLAGS="${ABIFLAGS}d"
 else AC_MSG_RESULT(no); Py_DEBUG='false'
 fi],
 [AC_MSG_RESULT(no)])


(That's a temporary patch, I will design a better solution later.)

Using this patch + PR 12946, it becomes possible to load a C extension compiled 
in release mode in a debug Python!


---

Example building lxml in release mode and then load it in debug mode.


Install Python in *release* mode into /opt/py38release (shared libpython):

git clean -fdx; ./configure --enable-shared --prefix /opt/py38release && make 
&& make install


Install Python in *debug* mode into /opt/py38debug (shared libpython):

git clean -fdx; ./configure CFLAGS="-O0" --enable-shared --prefix 
/opt/py38debug --with-pydebug && make && make install


Build lxml in release mode:

LD_LIBRARY_PATH=/opt/py38release/lib/ /opt/py38release/bin/python3.8 -m pip 
install lxml


By default, the debug Python doesn't have lxml:

$ LD_LIBRARY_PATH=/opt/py38debug/lib/ /opt/py38debug/bin/python3.8  -c 'import 
lxml'
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'lxml'


Give access to C extensions compiled in release mode to the debug Python:

$ LD_LIBRARY_PATH=/opt/py38debug/lib/ 
PYTHONPATH=/opt/py38release/lib/python3.8/site-packages 
/opt/py38debug/bin/python3.8 
Python 3.8.0a3+ (heads/omit_libpython-dirty:8a03782387, Apr 25 2019, 02:52:01) 
>>> import lxml
>>> import lxml.etree
>>> lxml.etree

>>> import sys
>>> sys.gettotalrefcount()
108304

It works!

Explanation:

* This is a debug build: sys.gettotalrefcount() is present (and works)
* lxml has been compiled in release mode
* etree.cpython-38-x86_64-linux-gnu.so is not linked to libpython and so 
doesn't rely on the *release* /opt/py38release/lib/libpython3.8.so
* this lxml can be loaded in a Python compiled in debug mode!

---

Now let's have a look at the gdb experience of release vs debug Python build.

I put a breakpoint on lxml.etree.iterparse('example.xml'): the C function is 
called __pyx_tp_new_4lxml_5etree_iterparse.


Using the release build, gdb fails to read many C local variables:

$ LD_LIBRARY_PATH=/opt/py38release/lib/ gdb -args 
/opt/py38release/bin/python3.8 parse.py 

(gdb) source /home/vstinner/prog/python/master/python-gdb.py 
(gdb) b __pyx_tp_new_4lxml_5etree_iterparse
Function "__pyx_tp_new_4lxml_5etree_iterparse" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
(gdb) run

Breakpoint 1, __pyx_tp_new_4lxml_5etree_iterparse (t=0x7fffea724900 
<__pyx_type_4lxml_5etree_iterparse>, a=('example.xml',), k=0x0) at 
src/lxml/etree.c:218930
218930  src/lxml/etree.c: No such file or directory.

(gdb) py-bt
Traceback (most recent call first):
  File "parse.py", line 4, in func
context = etree.iterparse('example.xml')
  File "parse.py", line 12, in 
func("arg")

(gdb) frame 4
#4  _PyEval_EvalFrameDefault (f=, throwflag=) at 
Python/ceval.c:3268
3268res = call_function(, oparg, NULL);
(gdb) p f
$1 = 
(gdb) p co
$2 = 
(gdb) p sp
$3 = 
(gdb) p oparg
$4 = 

The basic function "py-bt" works as expected, but inspecting Python internals 
doesn't work: most local C variables are "optimized out" :-(



New attempt using a debug build:

$ LD_LIBRARY_PATH=/opt/py38debug/lib/ 
PYTHONPATH=/opt/py38release/lib/python3.8/site-packages gdb -args 
/opt/py38debug/bin/python3.8 parse.py 

... same commands to load python-gdb.py and put a breakpoint ...

Breakpoint 1, __pyx_tp_new_4lxml_5etree_iterparse (t=0x7fffea606900 
<__pyx_type_4lxml_5etree_iterparse>, a=('example.xml',), k=0x0) at 
src/lxml/etree.c:218930
218930  src/lxml/etree.c: No such file or directory.

(gdb) py-bt
Traceback (most recent call first):
  File "parse.py", line 4, in func
context = etree.iterparse('example.xml')
  File "parse.py", line 12, in 
func("arg")

(gdb) frame 4
#4  0x77d6e4f8 in 

[issue36715] Dictionary initialization

2019-04-24 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue23298] Add ArgumentParser.add_mutually_dependence_group

2019-04-24 Thread Martin Panter


Change by Martin Panter :


--
superseder:  -> Add "necessarily inclusive" groups to argparse

___
Python tracker 

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



[issue36717] Allow retrieval of return value from the target of a threading.Thread

2019-04-24 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +pitrou

___
Python tracker 

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



[issue22742] IDLE shows traceback when printing non-BMP character

2019-04-24 Thread Martin Panter

Martin Panter  added the comment:

I haven’t looked at the code, but I suspect Idle implements a custom 
“sys.displayhook”:

>>> help(sys.displayhook)
Help on function displayhook in module idlelib.rpc:

displayhook(value)
Override standard display hook to use non-locale encoding

>>> sys.displayhook('\N{ROCKET}')
'\U0001f680'
>>> sys.__displayhook__('\N{ROCKET}')
Traceback (most recent call last):
  File "", line 1, in 
sys.__displayhook__('\N{ROCKET}')
  File "/usr/lib/python3.5/idlelib/PyShell.py", line 1344, in write
return self.shell.write(s, self.tags)
UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 1-1: 
Non-BMP character not supported in Tk

--
nosy: +martin.panter

___
Python tracker 

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



[issue21536] extension built with a shared python cannot be loaded with a static python

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote PR 12946: "On Unix, C extensions are no longer linked to libpython".

Using PR 12946, the use case described in the initial message (msg218806) now 
works as expected. I can load a C extension built by a shared library Python 
with a statically linked Python:

$ LD_LIBRARY_PATH=/opt/py38shared/lib /opt/py38notshared/bin/python3.8
Python 3.8.0a3+ (heads/master:be0099719c, Apr 25 2019, 02:10:57) 
>>> import sys; sys.path.insert(0, '/opt/py38shared/lib/python3.8/lib-dynload')
>>> import _ssl
>>> _ssl


/opt/py38notshared/bin/python3.8 is statically linked, whereas 
/opt/py38shared/lib/python3.8/lib-dynload/_ssl.cpython-38-x86_64-linux-gnu.so 
comes from a shared library Python.

Install shared libray Python into /opt/py38shared:

git clean -fdx; ./configure CFLAGS="-O0" --enable-shared --prefix 
/opt/py38shared && make && make install

Install statically linked Python into /opt/py38notshared:

git clean -fdx; ./configure CFLAGS="-O0" --prefix /opt/py38notshared && make && 
make install

--

As Antoine said, the opposite already works. Just in case, I also tested and I 
confirm that it still works:

$ LD_LIBRARY_PATH=/opt/py38shared/lib /opt/py38shared/bin/python3.8
Python 3.8.0a3+ (heads/master:be0099719c, Apr 25 2019, 02:09:02) 
>>> import sys; sys.path.insert(0, 
>>> '/opt/py38notshared/lib/python3.8/lib-dynload')
>>> import _ssl
>>> _ssl


_ssl comes from statically linked Python (/opt/py38notshared) and is loaded in 
shared library Python (/opt/py38shared).

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



[issue21536] extension built with a shared python cannot be loaded with a static python

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-34814 is linked to this use case: 
> https://bugzilla.redhat.com/show_bug.cgi?id=1585201 is an example of Python 
> embedded in C using dlopen("libpython2.7.so.1.0", RTLD_LOCAL | RTLD_NOW). 
> Problem: some C extensions of the standard library cannot be loaded in this 
> case, like _struct.

bpo-1429775 is another example of RTLD_LOCAL usage, see:
https://mail.python.org/pipermail/python-dev/2006-February/060533.html

--

___
Python tracker 

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



[issue21536] extension built with a shared python cannot be loaded with a static python

2019-04-24 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +12870
stage:  -> patch review

___
Python tracker 

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



[issue21536] extension built with a shared python cannot be loaded with a static python

2019-04-24 Thread STINNER Victor

STINNER Victor  added the comment:

Antoine:
> Hmm, apparently the -l flag was added in #832799, for a rather complicated 
> case where the interpreter is linked with a library dlopened by an embedding 
> application (I suppose for some kind of plugin system). The OP there also 
> mentions RTLD_GLOBAL as a workaround (or perhaps the right way of achieving 
> the desired effect).
> (also, the OP didn't mention why he used a shared library build, instead of 
> linking Python statically with the dlopened library)

bpo-34814 is linked to this use case: 
https://bugzilla.redhat.com/show_bug.cgi?id=1585201 is an example of Python 
embedded in C using dlopen("libpython2.7.so.1.0", RTLD_LOCAL | RTLD_NOW). 
Problem: some C extensions of the standard library cannot be loaded in this 
case, like _struct.

On Fedora and RHEL, some C extensions like _struct are built by the "*shared*" 
section of Modules/Setup. In this case, these C extensions are not explicitly 
linked to libpython.

IHMO it's a bad usage of dlopen(): libpython must always be loaded with 
RTLD_GLOBAL.

bpo-832799 has been fixed by the following commit which modify distutils to 
link C extensions to libpython:

commit 10acfd00b28a2aad7b73d35afdbc64b0baebea20
Author: Martin v. Löwis 
Date:   Mon Apr 10 12:39:36 2006 +

Patch #1429775: Link Python modules to libpython on linux if
--enable-shared. Fixes #832799.

--

___
Python tracker 

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



[issue36711] duplicate method definition in Lib/email/feedparser.py

2019-04-24 Thread Martin Panter

Martin Panter  added the comment:

This is caused by Serhiy’s first change to 2.7 in Issue 21448. Compare 
Mercurial rev. 1b1f92e39462 (3.4 branch) with ba90bd01c5f1 (2.7). In 2.7, he 
applied the Python 3 version of the code, which used “str.splitlines” rather 
than a regular expression “NLCRE_crack.split”. This seems reasonable, but the 
old Python 2 code remains under a spurious “def pushlines” block.

I think that first block of “pushlines” can safely be removed, just leaving the 
second version, a single line of code like in Python 3.

--
components: +email -Library (Lib)
nosy: +barry, martin.panter, r.david.murray

___
Python tracker 

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



[issue36717] Allow retrieval of return value from the target of a threading.Thread

2019-04-24 Thread Joel Croteau


New submission from Joel Croteau :

It would be nice if, after a threading.Thread has completed its run, it were 
possible to retrieve the return value of the target function. You can do this 
currently by setting a variable from your target or by subclassing Thread, but 
this should really be built in. My suggested changes:
* Add an attribute to Thread, retval, initially set to None, that contains the 
return value of the target after a successful completion.
* Thread.run() should set self.retval to the return value of the target upon 
completion, and also return this value.
* Thread.join() should return self.retval after a successful completion.

If you're not using Thread.join(), you can directly access Thread.retval to get 
the return result after a successful run. Thread.run() and Thread.join() both 
return None in all cases now, so I think a change in their return value would 
have minimal if any effect on existing code.

--
components: Library (Lib)
messages: 340815
nosy: Joel Croteau2
priority: normal
severity: normal
status: open
title: Allow retrieval of return value from the target of a threading.Thread
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



[issue21536] extension built with a shared python cannot be loaded with a static python

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-34814.

--

___
Python tracker 

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



[issue36465] Make release and debug ABI compatible

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 235e7b2b0d937ba8b4a9172aa72206187e3e1f54 by Victor Stinner in 
branch 'master':
bpo-36465: Fix test_regrtest on Windows (GH-12945)
https://github.com/python/cpython/commit/235e7b2b0d937ba8b4a9172aa72206187e3e1f54


--

___
Python tracker 

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



[issue36465] Make release and debug ABI compatible

2019-04-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12869

___
Python tracker 

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



[issue36465] Make release and debug ABI compatible

2019-04-24 Thread STINNER Victor


Change by STINNER Victor :


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



[issue36465] Make release and debug ABI compatible

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f4e4703e746067d6630410408d414b11003334d6 by Victor Stinner in 
branch 'master':
bpo-36465: Make release and debug ABI compatible (GH-12615)
https://github.com/python/cpython/commit/f4e4703e746067d6630410408d414b11003334d6


--

___
Python tracker 

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



[issue36716] Embedded Python fails to import module files with version_platform extensions

2019-04-24 Thread Steve Dower


Steve Dower  added the comment:

Where are you running the embedded Python from, and how have you configured it 
to include the packages?

Is your install in Program Files from the full installer? Or have you extracted 
the embeddable distro there?

--

___
Python tracker 

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



[issue36716] Embedded Python fails to import module files with version_platform extensions

2019-04-24 Thread Eric Cosatto


Eric Cosatto  added the comment:

Yes, and note that the command line python works fine.

--

___
Python tracker 

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



[issue36716] Embedded Python fails to import module files with version_platform extensions

2019-04-24 Thread Steve Dower


Steve Dower  added the comment:

Are you sure you don't have the 32-bit version of Python and the 64-bit version 
of those packages?

--

___
Python tracker 

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



[issue36716] Embedded Python fails to import module files with version_platform extensions

2019-04-24 Thread Eric Cosatto


New submission from Eric Cosatto :

I have an application with embedded python. When trying to import numpy, or any 
other module that was installed by pip, it fails with error 
'ModuleNotFoundError("No module named ...")'. Yet, on the command line python, 
all works fine. The problem is not in the PATH, as only specific files (those 
with ..pyd extensions, e.g. .cp37-win_amd64.pyd) cannot be 
found. 

Example1: numpy

import numpy
>> ImportError("No module named 'numpy.core._multiarray_umath')

The line which fails is:
from . import multiarray
The file it is trying to load:
C:\Program 
Files\Python37\Lib\site-packages\numpy\core_multiarray_umath.cp37-win_amd64.pyd


Example 2: cv2

import cv2
>> ModuleNotFoundError("No module named 'cv2.cv2'")
The line which fails is:
from .cv2 import *
The file it is trying to load:
C:\Program Files\Python37\Lib\site-packages\cv2\cv2.cp37-win_amd64.pyd

--
components: Extension Modules, Windows
messages: 340808
nosy: ecosatto, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Embedded Python fails to import module files with version_platform 
extensions
type: behavior
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



[issue22269] Resolve distutils option conflicts with priorities

2019-04-24 Thread László Kiss Kollár

Change by László Kiss Kollár :


--
nosy: +lkollar

___
Python tracker 

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



[issue36715] Dictionary initialization

2019-04-24 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

This is the same basic problem seen with sequence multiplication, mutable 
default arguments to a function, etc. It's not going to change though; the 
documentation says it "Create a new dictionary with keys from iterable and 
values set to value." "set to value" doesn't allow for implicit copy operations 
(shallow or deep), and trying to support it would slow fromkeys and violate the 
normal expectations for functions that reuse an input argument. Essentially, 
the problem you have is one of expectations; the behavior is correct, but 
perhaps the documentation could be clearer.

In any event, the general solution to your problem is a dict comprehension (or 
for dict subclasses, passing a generator expression to the subclass 
constructor), replacing the incorrect:

dict.fromkeys(iterable, [])

with the similarly concise/straightforward:

{k: [] for k in iterable}

or (for general use, where dict can be changed to a dict subclass):

dict((k, []) for k in iterable)

I've marked this as a documentation bug if someone wants to take a stab at 
making the behavior more clear.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, josh.r

___
Python tracker 

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



[issue36670] test suite broken due to cpu usage feature on win 10/ german

2019-04-24 Thread Eryk Sun


Eryk Sun  added the comment:

It's "oem", not "mbcs".

--

___
Python tracker 

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



[issue36715] Dictionary initialization

2019-04-24 Thread Aditya Sane


New submission from Aditya Sane :

When initializing a dictionary with dict.fromkeys, if an object is used as 
initial value, then the value is taken by reference instead of by value.
This results in incorrect behavior since Python doesn't have "by reference" or 
pointers by default.
Attached file shows an example and one work-around.

--
files: DictionaryBug.py
messages: 340805
nosy: Aditya Sane
priority: normal
severity: normal
status: open
title: Dictionary initialization
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48286/DictionaryBug.py

___
Python tracker 

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



[issue36668] semaphore_tracker is not reused by child processes

2019-04-24 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset 004b93ea8947bcbe85b6fa16fe0999bfa712d5c1 by Antoine Pitrou 
(Thomas Moreau) in branch 'master':
bpo-36668: FIX reuse semaphore tracker for child processes (#5172)
https://github.com/python/cpython/commit/004b93ea8947bcbe85b6fa16fe0999bfa712d5c1


--

___
Python tracker 

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



[issue36668] semaphore_tracker is not reused by child processes

2019-04-24 Thread Antoine Pitrou


Change by Antoine Pitrou :


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



[issue36695] Change (regression?) in v3.8.0a3 doctest output after capturing the stderr output from a raised warning

2019-04-24 Thread Brian Skinn


Brian Skinn  added the comment:

LOL. No special thanks necessary, that last post only turned into something 
coherent (and possibly correct, it seems...) after a LOT of diving into the 
source, fiddling with the code, and (((re-)re-)re-)writing! Believe me, it 
reads as a lot more knowledgeable and confident than I actually felt while 
writing it. :-D

Thanks to all of you for coming along with me on this dive into the CPython 
internals!

--

___
Python tracker 

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



[issue36541] Make lib2to3 grammar more closely match Python

2019-04-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

For the changes of PEP570, please wait until I merge the implementation to do 
the grammar changes in lib2to3 for that.

--

___
Python tracker 

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



[issue36695] Change (regression?) in v3.8.0a3 doctest output after capturing the stderr output from a raised warning

2019-04-24 Thread Thomas Kluyver


Thomas Kluyver  added the comment:

D'oh, yes. I missed that the failing example was displaying the captured string 
through displayhook. It makes sense now. Thanks for patiently explaining. :-)

--

___
Python tracker 

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



[issue36688] _dummy_thread lacks an RLock implementaiton

2019-04-24 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +12867
stage:  -> patch review

___
Python tracker 

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



[issue36708] can not execute the python + version, to launch python under windows.

2019-04-24 Thread Steve Dower


Steve Dower  added the comment:

More precisely, the default Python install for Windows does not include 
versioned executables.

If you install Python 3.7 from the Microsoft Store then you will get them, 
though it's not identical to the full development kit you'll get from 
python.org.

There may be other distributions that include versioned executables as well. 
Ours will only put "python.exe" on PATH

--

___
Python tracker 

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



[issue36695] Change (regression?) in v3.8.0a3 doctest output after capturing the stderr output from a raised warning

2019-04-24 Thread Brian Skinn


Brian Skinn  added the comment:

Well, the warning content *itself* may not get passed through the displayhook 
at raise-time, in the process of being run through stderr and displayed by the 
REPL.

But, when you capture the warning content with redirect_stderr(sio) and then 
">>> sio.getvalue()", the contents of the capture from stderr, as produced by 
.getvalue(), *will* get passed through the displayhook, and thus be escaped.



In theory, I could have obtained a consistent 'want' by using print() as you've 
done. However, for my particular example (see OP), I wanted to elide the first 
part of the warning message, which is messy, irrelevant to my code example, and 
can change from Python version to Python version. However, as doctest is 
currently implemented, a 'want' can't start with an ellipsis because it 
collides with the regex that detects PS2 prompts 
(https://github.com/python/cpython/blob/4f5a3493b534a95fbb01d593b1ffe320db6b395e/Lib/doctest.py#L583-L586).

See #36714 (https://bugs.python.org/issue36714) for more information and a 
proposed enhancement/fix.

--

___
Python tracker 

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



[issue36695] Change (regression?) in v3.8.0a3 doctest output after capturing the stderr output from a raised warning

2019-04-24 Thread Thomas Kluyver


Thomas Kluyver  added the comment:

The 'single' option to compile() means it's run like at a REPL, calling 
displayhook if it's an expression returning a value.

But warnings shouldn't go through the displayhook, as far as I know:

>>> from contextlib import redirect_stdout, redirect_stderr
>>> from io import StringIO
>>> sio = StringIO()
>>> with redirect_stderr(sio):
...   exec(compile('import warnings; warnings.warn(""" \' " """)', 'dummyfile', 
'single'))
... 
>>> print(sio.getvalue())
__main__:1: UserWarning:  ' "

--

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-24 Thread Eric Snow


Change by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue36654] Add example to tokenize.tokenize

2019-04-24 Thread Lisa Roach


Lisa Roach  added the comment:

This could be added to the examples section of the tokenize doc, would you want 
to make the PR Windson?

--
nosy: +lisroach

___
Python tracker 

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



[issue36708] can not execute the python + version, to launch python under windows.

2019-04-24 Thread Brett Cannon


Brett Cannon  added the comment:

This is by design in the Windows installer. You can check a box to put 
python3.6 on PATH if you want.

If you want the Python Launcher on UNIX, see 
https://crates.io/crates/python-launcher.

--
nosy: +brett.cannon
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



[issue35224] PEP 572: Assignment Expressions

2019-04-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

> Maybe we could update the What's New quickly now, and then get the longer 
> more complex docs done later?  People have been asking if this feature is in 
> 3.8 because they don't see it mentioned.

Here it is (PR 12941)

--

___
Python tracker 

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



[issue36670] test suite broken due to cpu usage feature on win 10/ german

2019-04-24 Thread Lorenz Mende


Lorenz Mende  added the comment:

Sorry, was off some days. I tried to decode the output with mbcs, solves the 
issue partly - the counter name is still wrong.
Was able to pick the localization specific counter name from registry and use 
it for the typeperf.

But the tests fail after several seconds with Broken Pipe Error of the 
command_stdout pipe.

@Ammar - why is the handle closed in start()? If I uncomment it, the load 
tracker workks fine.

Added the fixed file, may someone evaluate the solution on another windows 
localization?

--
Added file: https://bugs.python.org/file48285/win_utils.py

___
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-04-24 Thread Guido van Rossum


Change by Guido van Rossum :


--
pull_requests: +12865

___
Python tracker 

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



[issue36540] PEP 570: Python Positional-Only Parameters

2019-04-24 Thread Guido van Rossum


Change by Guido van Rossum :


--
pull_requests: +12866

___
Python tracker 

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



[issue36695] Change (regression?) in v3.8.0a3 doctest output after capturing the stderr output from a raised warning

2019-04-24 Thread Brian Skinn


Brian Skinn  added the comment:

The application of repr() (or a repr()-equivalent) appears to occur as some 
part of the exec(compile(...)) call within doctest 
(https://github.com/python/cpython/blob/4f5a3493b534a95fbb01d593b1ffe320db6b395e/Lib/doctest.py#L1328-L1329).

On 3.6.6, in REPL:

```
>>> from contextlib import redirect_stdout
>>> from io import StringIO
>>> sio = StringIO()
>>> with redirect_stdout(sio):
... exec(compile('""" \' " """', 'dummyfile', 'single'))
...
>>> output = sio.getvalue()
>>> output
'\' \\\' " \'\n'
```

Also 3.6.6, at Win cmd:

```
>type exec_compile.py
from contextlib import redirect_stdout
from io import StringIO

exec(compile('""" \' " """', 'dummyfile', 'single'))

sio = StringIO()
with redirect_stdout(sio):
exec(compile('""" \' " """', 'dummyfile', 'single'))

output = sio.getvalue()

assert output == '\' \\\' " \'\n'

>python exec_compile.py
' \' " '

>
```

It *looks* like exec() executes the compile()'d source as if it were typed into 
a REPL -- IOW, any unassigned non-None return value X gets pushed to stdout as 
repr(X). This is then what the doctest self._fakeout captures for comparison to 
the 'want' of the example.

--

___
Python tracker 

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



[issue21536] extension built with a shared python cannot be loaded with a static python

2019-04-24 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
versions: +Python 3.7, Python 3.8 -Python 3.5

___
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-04-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

I will add stub sections to the 3.8 whatsnew.

--

___
Python tracker 

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



[issue21536] extension built with a shared python cannot be loaded with a static python

2019-04-24 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
nosy: +vstinner

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 43125224d6da5febb34101ebfd36536d791d68cd by Victor Stinner in 
branch 'master':
bpo-36710: Add runtime variable to Py_InitializeEx() (GH-12939)
https://github.com/python/cpython/commit/43125224d6da5febb34101ebfd36536d791d68cd


--

___
Python tracker 

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



[issue36616] Optimize thread state handling in function call code

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:

See also my PR 12934 which includes a similar change but for correctness, not 
for optimization.

--

___
Python tracker 

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



[issue36714] Tweak doctest 'example' regex to allow a leading ellipsis in 'want' line

2019-04-24 Thread Brian Skinn


New submission from Brian Skinn :

doctest requires code examples have PS1 as ">>> " and PS2 as "... " -- that is, 
each is three printed characters, followed by a space:

```
$ cat ell_err.py
import doctest

class Foo:
"""Test docstring.

>>>print("This is a test sentence.")
...a test...

"""

doctest.run_docstring_examples(
Foo(),
{},
optionflags=doctest.ELLIPSIS,
)

$ python3.8 --version
Python 3.8.0a3
$ python3.8 ell_err.py
Traceback (most recent call last):
...
ValueError: line 3 of the docstring for NoName lacks blank after >>>: '
>>>print("This is a test sentence.")'


$ cat ell_print.py
import doctest

class Foo:
"""Test docstring.

>>> print("This is a test sentence.")
...a test...

"""

doctest.run_docstring_examples(
Foo(),
{},
optionflags=doctest.ELLIPSIS,
)

$ python3.8 ell_print.py
Traceback (most recent call last):
...
ValueError: line 4 of the docstring for NoName lacks blank after ...: '...a 
test...'

```

AFAICT, this behavior is consistent across 3.4.10, 3.5.7, 3.6.8, 3.7.3, and 
3.8.0a3.


**However**, in this `ell_print.py` above, that "PS2" line isn't actually meant 
to be a continuation of the 'source' portion of the example; it's meant to be 
the *output* (the 'want') of the example, with a leading ellipsis to be matched 
per `doctest.ELLIPSIS` rules.

The regex currently used to look for the 'source' of an example is 
(https://github.com/python/cpython/blob/4f5a3493b534a95fbb01d593b1ffe320db6b395e/Lib/doctest.py#L583-L586):

```
(?P
(?:^(?P [ ]*) >>>.*)# PS1 line
(?:\n   [ ]*  \.\.\. .*)*)  # PS2 lines
\n?
```

Since this pattern is compiled with re.VERBOSE 
(https://github.com/python/cpython/blob/4f5a3493b534a95fbb01d593b1ffe320db6b395e/Lib/doctest.py#L592),
 the space-as-fourth-character in PS1/PS2 is not explicitly matched.

I propose changing the regex to:

```
(?P
(?:^(?P [ ]*) >>>[ ].*)# PS1 line
(?:\n   [ ]*  \.\.\.[ ] .*)*)  # PS2 lines
\n?
```

This will then *explicitly* match the trailing space of PS1; it *shouldn't* 
break any existing doctests, because the parsing code lower down has already 
been requiring that space to be present in PS1, as shown for `ell_err.py` above.

This will also require an *explicit trailing space* to be present in order for 
a line starting with three periods to be interpreted as a PS2 line of 'source'; 
otherwise, it will be treated as part of the 'want'.  I made this change in my 
local user install of 3.8's doctest.py, and it works as I expect on 
`ell_print.py`, passing the test:

```
$ python3.8 ell_print.py
$
$ cat ell_wrongprint.py
import doctest

class Foo:
"""Test docstring.

>>> print("This is a test sentence.")
...a foo test...

"""

doctest.run_docstring_examples(
Foo(),
{},
optionflags=doctest.ELLIPSIS,
)

$ python3.8 ell_wrongprint.py
**
File "ell_wrongprint.py", line ?, in NoName
Failed example:
print("This is a test sentence.")
Expected:
...a foo test...
Got:
This is a test sentence.

```

For completeness, the following piece of regex in the 'want' section 
(https://github.com/python/cpython/blob/4f5a3493b534a95fbb01d593b1ffe320db6b395e/Lib/doctest.py#L589):

```
(?![ ]*>>>)  # Not a line starting with PS1
```

should probably also be changed to:

```
(?![ ]*>>>[ ])  # Not a line starting with PS1
```


I would be happy to put together a PR for this; I would plan to take a ~TDD 
style approach, implementing a few tests first and then making the regex change.

--
components: Library (Lib)
messages: 340788
nosy: bskinn
priority: normal
severity: normal
status: open
title: Tweak doctest 'example' regex to allow a leading ellipsis in 'want' line
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



[issue36541] Make lib2to3 grammar more closely match Python

2019-04-24 Thread Lisa Roach


Lisa Roach  added the comment:

I agree we should get lib2to3 up to date.

Looks like for *args and **kwargs there is issue33348 (this has a PR) and 
issue32496 (no PR) and related closed issue24791 and issue24176. 

Adding `:=` seems straighforward to me, as for the big change maybe 
@benjamin.peterson would be interested in commenting?

--
nosy: +lisroach

___
Python tracker 

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



[issue30840] Contrary to documentation, relative imports cannot pass through the top level

2019-04-24 Thread Nick Coghlan


Change by Nick Coghlan :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type: behavior -> enhancement
versions: +Python 3.8 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue30840] Contrary to documentation, relative imports cannot pass through the top level

2019-04-24 Thread Nick Coghlan


Nick Coghlan  added the comment:


New changeset 4d0233ec656bc7e7814e5f6f484e79a50a0daf91 by Nick Coghlan (Miss 
Islington (bot)) in branch '3.7':
bpo-30840: Document relative imports (GH-12831) (GH-12938)
https://github.com/python/cpython/commit/4d0233ec656bc7e7814e5f6f484e79a50a0daf91


--

___
Python tracker 

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



[issue16079] list duplicate test names with patchcheck

2019-04-24 Thread Xavier de Gaye


Xavier de Gaye  added the comment:

Not sure the unittest module is the right place to implement these checks.
The following issues deal with duplicates that are not unittest methods:

#19127 #19128 #36711

--

___
Python tracker 

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



[issue16079] list duplicate test names with patchcheck

2019-04-24 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
pull_requests: +12864

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 8e91c246e468515b877690e090c73f496552541d by Victor Stinner in 
branch 'master':
bpo-36710: Add runtime variable to Py_FinalizeEx() (GH-12937)
https://github.com/python/cpython/commit/8e91c246e468515b877690e090c73f496552541d


--

___
Python tracker 

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



[issue16079] list duplicate test names with patchcheck

2019-04-24 Thread Xavier de Gaye


Xavier de Gaye  added the comment:

List of issues entered for all the current duplicate method definitions in 2.7:

#19113 #36711 #36712 #36713

--

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12863

___
Python tracker 

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



[issue36713] uplicate method definition in Lib/ctypes/test/test_unicode.py

2019-04-24 Thread Xavier de Gaye


New submission from Xavier de Gaye :

As reported in issue 16079, the following method is a duplicate:

Lib/ctypes/test/test_unicode.py:110 StringTestCase.test_ascii_replace

--
components: Library (Lib)
messages: 340782
nosy: xdegaye
priority: normal
severity: normal
stage: needs patch
status: open
title: uplicate method definition in Lib/ctypes/test/test_unicode.py
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue19119] duplicate test name in Lib/test/test_heapq.py

2019-04-24 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
versions: +Python 3.8 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue19113] duplicate test names in Lib/ctypes/test/test_functions.py

2019-04-24 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
versions: +Python 2.7, Python 3.8 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue26528] NameError for built in function open when re-raising stored exception from yielded function

2019-04-24 Thread Davide Rizzo


Davide Rizzo  added the comment:

I've just stumbled on the same thing happening on some code that attempts to 
use logging on __del__.

Comparing dir(__builtins__) normally and on shutdown, these are missing:

['copyright', 'credits', 'exit', 'help', 'license', 'open', 'quit']

The traceback of the real error looks like this:

  [...]
  File 
"/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py",
 line 1383, in info
  File 
"/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py",
 line 1519, in _log
  File 
"/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py",
 line 1529, in handle
  File 
"/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py",
 line 1591, in callHandlers
  File 
"/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py",
 line 905, in handle
  File 
"/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py",
 line 1131, in emit
  File 
"/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py",
 line 1121, in _open
NameError: name 'open' is not defined

--
nosy: +davide.rizzo
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



[issue30840] Contrary to documentation, relative imports cannot pass through the top level

2019-04-24 Thread Nick Coghlan


Nick Coghlan  added the comment:


New changeset 70bf713617e15fad390ed953e48b3c65d9bc90ec by Nick Coghlan (Joannah 
Nanjekye) in branch 'master':
bpo-30840: Document relative imports (#12831)
https://github.com/python/cpython/commit/70bf713617e15fad390ed953e48b3c65d9bc90ec


--

___
Python tracker 

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



[issue36711] duplicate method definition in Lib/email/feedparser.py

2019-04-24 Thread Xavier de Gaye


New submission from Xavier de Gaye :

As reported in issue 16079, the following method is a duplicate:

Lib/email/feedparser.py:140 BufferedSubFile.pushlines

--
components: Library (Lib)
messages: 340778
nosy: xdegaye
priority: normal
severity: normal
stage: needs patch
status: open
title: duplicate method definition in Lib/email/feedparser.py
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue30840] Contrary to documentation, relative imports cannot pass through the top level

2019-04-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12862

___
Python tracker 

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



[issue36712] duplicate method definition in Lib/email/test/test_email_renamed.py

2019-04-24 Thread Xavier de Gaye


New submission from Xavier de Gaye :

As reported in issue 16079, the following method is a duplicate:

Lib/email/test/test_email_renamed.py:521 TestEncoders.test_default_cte

--
components: Library (Lib)
messages: 340781
nosy: xdegaye
priority: normal
severity: normal
stage: needs patch
status: open
title: duplicate method definition in Lib/email/test/test_email_renamed.py
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b930a2d2b1247bdba560db341ba90a9cbb538eb3 by Victor Stinner in 
branch 'master':
bpo-36710: PyOS_AfterFork_Child() pass runtime parameter (GH-12936)
https://github.com/python/cpython/commit/b930a2d2b1247bdba560db341ba90a9cbb538eb3


--

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12861

___
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-04-24 Thread Vedran Čačić

Vedran Čačić  added the comment:

... and probably also because they start Python, type

x := 2

and get SyntaxError (as explained above). ;-)

--

___
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-04-24 Thread Ned Batchelder


Ned Batchelder  added the comment:

Maybe we could update the What's New quickly now, and then get the longer more 
complex docs done later?  People have been asking if this feature is in 3.8 
because they don't see it mentioned.

--

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12860

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 8bb3230149538c25c1bacced5e64a3c071475f73 by Victor Stinner in 
branch 'master':
bpo-36710: Add runtime parameter to _PyThreadState_Init() (GH-12935)
https://github.com/python/cpython/commit/8bb3230149538c25c1bacced5e64a3c071475f73


--

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12859

___
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-04-24 Thread Emily Morehouse


Emily Morehouse  added the comment:

Ned is correct! I will be sprinting on docs for this at PyCon.

--

___
Python tracker 

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



[issue36707] The "m" ABI flag of SOABI for pymalloc is no longer needed

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 6c44fde3e03079e0c69f823dafbe04af50b5bd0d by Victor Stinner in 
branch 'master':
bpo-36707: Remove the "m" flag (pymalloc) from SOABI (GH-12931)
https://github.com/python/cpython/commit/6c44fde3e03079e0c69f823dafbe04af50b5bd0d


--

___
Python tracker 

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



[issue36475] PyEval_AcquireLock() and PyEval_AcquireThread() do not handle runtime finalization properly.

2019-04-24 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



[issue36707] The "m" ABI flag of SOABI for pymalloc is no longer needed

2019-04-24 Thread STINNER Victor


Change by STINNER Victor :


--
components: +Build
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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-24 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +12858
stage:  -> patch review

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-24 Thread STINNER Victor


New submission from STINNER Victor :

Eric Snow moved global variables into a _PyRuntimeState structure which is made 
of sub-structures. There is a single instance of _PyRuntimeState: the 
_PyRuntime global variable.

I would like to add "_PyRuntimeState *" parameters to functions to avoid 
relying directly on _PyRuntime global variable. The long term goal is to have 
"stateless" code: don't rely on global variables, only on input parameters. In 
practice, we will continue to use thread local storage (TLS) to get the 
"current context" like the current interpreter and the current Python thread 
state.

--
components: Interpreter Core
messages: 340772
nosy: vstinner
priority: normal
severity: normal
status: open
title: Pass _PyRuntimeState as an argument rather than using the _PyRuntime 
global variable
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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-24 Thread Matej Cepl


Matej Cepl  added the comment:

OK, vstinner asked me for more explanation:

 * we at openSUSE are as opposed to rpath as Fedora developers (actually, 
https://en.opensuse.org/openSUSE:Packaging_checks#Beware_of_Rpath is stolen 
from Fedora wiki, apparently)

 * none of Python packages (python2, python3 in all various *SUSE related 
distributions) has the mentioned patch

 * in all 11794 SPEC files in openSUSE Factory only 36 packages use chrpath 
(many other packages either patch ./configure or use various --disable-rpath 
options), and there is only one Python related package, python-cx_Freeze among 
them. Its SPEC file is 
https://build.opensuse.org/package/view_file/devel:languages:python/python-cx_Freeze/python-cx_Freeze.spec?expand=1
 , but I would think that is (being a compiler) quite specialized package which 
may do something strange.

 * We run rpmlint with checks for rpath enabled on all submissions to our build 
systems, so it shouldn't go unnoticed.

 * generally, it seems to me, that the patch is really unnecessary for us.

--

___
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-04-24 Thread Ned Batchelder


Ned Batchelder  added the comment:

3.8.0a3 is out, and the What's New still doesn't mention this work yet.

--
nosy: +nedbat

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-24 Thread Matej Cepl

Matej Cepl  added the comment:

Just to add my CZK 0.02 (or €0,0008 ;)). We don't have this patch in openSUSE 
Python packages, we run rpmlint on all submissions to our build system (so 
unwanted rpath shouldn't sneak into the distribution), and yet the only Python 
C extension which needs RPATH manipulation is cx_Freeze, and that is apparently 
somehow strange package.

--
nosy: +mcepl

___
Python tracker 

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



[issue33608] Add a cross-interpreter-safe mechanism to indicate that an object may be destroyed.

2019-04-24 Thread Kubilay Kocak


Kubilay Kocak  added the comment:

@Eric Happy to give you SSH access to one of the FreeBSD buildbots that's 
experienced the crash if it helps. Just flick me a pubkey, I'm on IRC (koobs @ 
freenode / #python-dev)

--
nosy: +koobs

___
Python tracker 

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



[issue36632] test_multiprocessing_forkserver: test_rapid_restart() leaked a dangling process on AMD64 FreeBSD 10-STABLE Non-Debug 3.x

2019-04-24 Thread Kubilay Kocak


Change by Kubilay Kocak :


--
nosy: +koobs

___
Python tracker 

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



[issue35755] On Unix, shutil.which() and subprocess no longer look for the executable in the current directory if PATH environment variable is not set

2019-04-24 Thread Kubilay Kocak


Change by Kubilay Kocak :


--
nosy: +koobs

___
Python tracker 

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



[issue36454] test_time: test_monotonic() failed on AMD64 FreeBSD 10-STABLE Non-Debug 3.7

2019-04-24 Thread Kubilay Kocak


Change by Kubilay Kocak :


--
nosy: +koobs

___
Python tracker 

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



[issue36707] The "m" ABI flag of SOABI for pymalloc is no longer needed

2019-04-24 Thread Kubilay Kocak


Change by Kubilay Kocak :


--
nosy: +koobs

___
Python tracker 

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



[issue36669] weakref proxy doesn't support the matrix multiplication operator

2019-04-24 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

Yeah, seems like a simple oversight to me. (Actually this is the first I've 
heard of weakref.proxy...)

--

___
Python tracker 

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



[issue36707] The "m" ABI flag of SOABI for pymalloc is no longer needed

2019-04-24 Thread STINNER Victor


STINNER Victor  added the comment:

pymalloc is enabled by default. --without-pymalloc allows to build Python
without pymalloc and use malloc by default.

--

___
Python tracker 

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



[issue36708] can not execute the python + version, to launch python under windows.

2019-04-24 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



[issue36709] Asyncio SSL keep-alive connections raise errors after loop close.

2019-04-24 Thread Tom Christie


Tom Christie  added the comment:

This appears somewhat related: https://bugs.python.org/issue34506

As it *also* logs exceptions occuring during `_fatal_error` and `_force_close`.

--

___
Python tracker 

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



[issue36708] can not execute the python + version, to launch python under windows.

2019-04-24 Thread sakamotoaya


Change by sakamotoaya :


--
nosy: +CuriousLearner, docs@python, ncoghlan, ronaldoussoren, serhiy.storchaka, 
xtreak

___
Python tracker 

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



[issue36709] Asyncio SSL keep-alive connections raise errors after loop close.

2019-04-24 Thread Tom Christie


New submission from Tom Christie :

If an asyncio SSL connection is left open (eg. any kind of keep-alive 
connection) then after closing the event loop, an exception will be raised...

Python:

```
import asyncio
import ssl
import certifi


async def f():
ssl_context = ssl.create_default_context()
ssl_context.load_verify_locations(cafile=certifi.where())
await asyncio.open_connection('example.org', 443, ssl=ssl_context)


loop = asyncio.get_event_loop()
loop.run_until_complete(f())
loop.close()
```

Traceback:

```
$ python example.py 
Fatal write error on socket transport
protocol: 
transport: <_SelectorSocketTransport fd=8>
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py",
 line 868, in write
n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor
Fatal error on SSL transport
protocol: 
transport: <_SelectorSocketTransport closing fd=8>
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py",
 line 868, in write
n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/sslproto.py",
 line 676, in _process_write_backlog
self._transport.write(chunk)
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py",
 line 872, in write
self._fatal_error(exc, 'Fatal write error on socket transport')
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py",
 line 681, in _fatal_error
self._force_close(exc)
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py",
 line 693, in _force_close
self._loop.call_soon(self._call_connection_lost, exc)
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py",
 line 677, in call_soon
self._check_closed()
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py",
 line 469, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
```

It looks to me like the original "OSError: [Errno 9] Bad file descriptor" 
probably shouldn't be raised in any case - if when attempting to tear down the 
SSL connection, then we should probably pass silently in the case that the 
socket has already been closed uncleanly.

Bought to my attention via: https://github.com/encode/httpcore/issues/16

--
assignee: christian.heimes
components: SSL, asyncio
messages: 340764
nosy: asvetlov, christian.heimes, tomchristie, yselivanov
priority: normal
severity: normal
status: open
title: Asyncio SSL keep-alive connections raise errors after loop close.
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



[issue36669] weakref proxy doesn't support the matrix multiplication operator

2019-04-24 Thread Mark Dickinson


Change by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue36669] weakref proxy doesn't support the matrix multiplication operator

2019-04-24 Thread Mark Dickinson


Mark Dickinson  added the comment:

Adding Nathaniel Smith (the matrix multiplication PEP author), just in case he 
knows some reason why weakref.proxy objects should _not_ support the matrix 
multiplication operator.

--
nosy: +njs

___
Python tracker 

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



[issue36639] Provide list.rindex()

2019-04-24 Thread 林自均

林自均  added the comment:

Hi @SilentGhost,

Yes, sorry I didn't make it clear. I was just posting the discussion here for 
some reference, not claiming that this issue should be reopened.

--

___
Python tracker 

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



[issue36669] weakref proxy doesn't support the matrix multiplication operator

2019-04-24 Thread Mark Dickinson


Change by Mark Dickinson :


--
keywords: +patch
pull_requests: +12857
stage:  -> patch review

___
Python tracker 

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



[issue36708] can not execute the python + version, to launch python under windows.

2019-04-24 Thread sakamotoaya

New submission from sakamotoaya :

I am sorry if it is existing problem

to launch Python 3.6, execute the command in Command Prompt under windows
py -3.6→Success
python3.6→Fail

to launch Python 3.6, execute the command in Command Prompt under Linux
py -3.6→Fail
python3.6→Success

I would like to unify the command.
What are your thoughts on that?

--
components: Windows
messages: 340761
nosy: HiyashiChuka, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: can not execute the python + version, to launch python under windows.
type: enhancement
versions: Python 2.7, 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



  1   2   >