[issue38414] Ordering a nested dictionary in python with json format

2019-10-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Dictionary preserve the insertion order starting from Python 3.7 (actually from 
3.6, but it was not guarantied). I am surprised that you got different result 
in 3.6. I cannot reproduce it.

In older Python versions you can pass object_pairs_hook=OrderedDict to 
json.loads() to preserve the insertion order. The regular dictionary cannot 
preserve it, by its structure.

--
nosy: +serhiy.storchaka
resolution:  -> out of date
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



[issue38368] Crash when subclassing ctypes.Union

2019-10-08 Thread Vinay Sajip


Change by Vinay Sajip :


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



[issue38368] Crash when subclassing ctypes.Union

2019-10-08 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 129c2b3d44a962fc5964ef8fd4e6b22dbb691a6c by Vinay Sajip in branch 
'3.7':
bpo-38368: Added fix for ctypes crash when handling arrays in structs/unions. 
(GH-16589) (GH-16672)
https://github.com/python/cpython/commit/129c2b3d44a962fc5964ef8fd4e6b22dbb691a6c


--

___
Python tracker 

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



[issue38368] Crash when subclassing ctypes.Union

2019-10-08 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset d004a5b082d0770682e6efbf03105a67469d4820 by Vinay Sajip in branch 
'3.8':
bpo-38368: Added fix for ctypes crash when handling arrays in structs/unions. 
(GH-16589) (GH-16671)
https://github.com/python/cpython/commit/d004a5b082d0770682e6efbf03105a67469d4820


--

___
Python tracker 

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



[issue38174] Security vulnerability in bundled expat CVE-2019-15903 (fix available in expat 2.2.8)

2019-10-08 Thread Larry Hastings


Larry Hastings  added the comment:


New changeset c386c8b06c6e92786f083ef6aba27b37087fdd20 by larryhastings (Victor 
Stinner) in branch '3.5':
closes bpo-38174: Update vendored expat library to 2.2.8. (GH-16346) (#16434)
https://github.com/python/cpython/commit/c386c8b06c6e92786f083ef6aba27b37087fdd20


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



[issue38368] Crash when subclassing ctypes.Union

2019-10-08 Thread Vinay Sajip


Change by Vinay Sajip :


--
pull_requests: +16253
pull_request: https://github.com/python/cpython/pull/16672

___
Python tracker 

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



[issue38368] Crash when subclassing ctypes.Union

2019-10-08 Thread Vinay Sajip


Change by Vinay Sajip :


--
keywords: +patch
pull_requests: +16252
pull_request: https://github.com/python/cpython/pull/16671

___
Python tracker 

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



[issue38419] The path of check-c-globals.py on README is wrong

2019-10-08 Thread Dong-hee Na


Dong-hee Na  added the comment:

This is newcomer friendly issue.

--

___
Python tracker 

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



[issue38419] The path of check-c-globals.py on README is wrong

2019-10-08 Thread Dong-hee Na


New submission from Dong-hee Na :

See 
https://github.com/python/cpython/blob/01171ebd966b0cd6352057799ad876dd1e07942e/Tools/c-analyzer/README#L37

--
keywords: newcomer friendly
messages: 354246
nosy: corona10
priority: normal
severity: normal
status: open
title: The path of check-c-globals.py on README is wrong

___
Python tracker 

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



[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-08 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> steven.daprano

___
Python tracker 

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



[issue38418] Audit event for os.system is incorrect

2019-10-08 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue38418] Audit event for os.system is incorrect

2019-10-08 Thread Steve Dower


New submission from Steve Dower :

It's documented as "os.system" but implemented as just "system".

--
assignee: steve.dower
messages: 354245
nosy: lukasz.langa, steve.dower
priority: normal
severity: normal
status: open
title: Audit event for os.system is incorrect
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



[issue36161] Use thread-safe functions instead of unsafe ones (crypt, ttyname)

2019-10-08 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 594e2edfb5e0d24e03469d035d8f39ff29a64d99 by Benjamin Peterson 
(Antonio Gutierrez) in branch 'master':
closes bpo-36161: Use thread-safe ttyname_r instead of ttyname. (GH-14868)
https://github.com/python/cpython/commit/594e2edfb5e0d24e03469d035d8f39ff29a64d99


--
nosy: +benjamin.peterson
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



[issue37677] Seg Fault on OSX when multiprocessing

2019-10-08 Thread Timothy Stonis


Timothy Stonis  added the comment:

Hi, I have the exact same issue and same stack trace from getaddrinfo (except 
Python 2.7). Same as original poster, it only happens every couple of weeks and 
I don't know how to reproduce. For me it's in an Odoo instance that spawns 
multiple workers with connections to a postgres database. I think this is a 
MacOS bug, since the issue does not happen on High Sierra (10.13).

--
nosy: +timstonis
versions: +Python 2.7 -Python 3.6

___
Python tracker 

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



[issue38417] Add support for settting umask in subprocess children

2019-10-08 Thread STINNER Victor


STINNER Victor  added the comment:

> I'm trying to make sure we track what is blocking people from getting rid of 
> preexec_fn in their existing code so that we can actually deprecate and get 
> rid of the API entirely.

If you consider posix_spawn(), I think that a convenient replacement for 
preexec_fn function would be a wrapper process which would execute *arbitrary 
Python code* before spawning the program.

It would not only cover umask case, but also prlimit, and another other custom 
code.

Pseudo-code of the wrapper:

  import sys
  code = sys.argv[1]
  argv = sys.argv[2:]
  eval(code)
  os.execv(argv[0], argv)

The main risk is that the arbitrary code could create an inheritable file 
descriptor (not all C extensions respect the PEP 446) which would survive after 
replacing the process memory with the new program.

Such design would allow to implement it in a third party package (on PyPI) for 
older Python versions as well.

--

Currently, preexec_fn is a direct reference to a callable Python object in the 
current process. preexec_fn calls it just after fork().

Here I'm talking about running arbitrary Python code in a freshly spawned 
Python process. It's different.

--

The new problems are:

* How to ensure that Python is configured as expected? Use -I command line 
option? Use -S to not import the site module? 
* How to report a Python exception from the child to the parent process? Build 
a pipe between the two processes and serialize the exception, as we are already 
doing for preexec_fn?
* How to report os.execv() failure to the parent? Just something like 
sys.exit(OSErrno.errno)?
* Should close_fds be implemented in the wrapper as well? If yes, can the 
parent avoid closing file descriptors?

> https://github.com/openstack/oslo.concurrency/blob/master/oslo_concurrency/prlimit.py

This wrapper uses os.execv().

--

___
Python tracker 

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



[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-08 Thread Warren Weckesser


Warren Weckesser  added the comment:

One more case where the "early out" produces a result that seems wrong:

In [20]: harmonic_mean([math.nan, 0])   
Out[20]: 0

Anyone who didn't know about the "early out" behavior would probably expect the 
result to be NAN.

--

___
Python tracker 

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



[issue38417] Add support for settting umask in subprocess children

2019-10-08 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

We don't have to for all possible things, doing this just reduced friction for 
existing uses.  In this case, calling umask in our child ourselves would be 
easy to support.  (easier than the more important setuid/sid/gid/groups-ish 
stuff that recently went in)

I'm trying to make sure we track what is blocking people from getting rid of 
preexec_fn in their existing code so that we can actually deprecate and get rid 
of the API entirely.

--
priority: high -> normal

___
Python tracker 

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



[issue38379] finalizer resurrection in gc

2019-10-08 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

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



[issue38417] Add support for settting umask in subprocess children

2019-10-08 Thread STINNER Victor


STINNER Victor  added the comment:

> We should add an explicit feature for this

If we need to write a wrapper program for that, I would say that no, we don't 
"have to" provide something in the stdlib.

In OpenStack, I wrote prlimit.py which is a preexec-like wrapper program to 
apply resource limits when calling a program. It's just a pure Python 
implementation of the Unix prlimit program. The Python implementation is used 
when the prlimit progrma is not available.

https://github.com/openstack/oslo.concurrency/blob/master/oslo_concurrency/prlimit.py

IMHO it's perfectly fine to explain that a wrapper program is needed to 
implement preexec-like features.

--
nosy: +vstinner

___
Python tracker 

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



[issue38417] Add support for settting umask in subprocess children

2019-10-08 Thread Gregory P. Smith


New submission from Gregory P. Smith :

Another use of the deprecated unsafe preexec_fn was to call os.umask in the 
child prior to exec.

As seen in https://github.com/freeipa/freeipa/pull/3769 (see the code in there).

We should add an explicit feature for this to avoid people's desire for 
preexec_fn or for the heavyweight workaround of an intermediate shell calling 
umask before doing another exec.

Any common preexec_fn uses that we can encode into supported parameters will 
help our ability to remove the ill fated preexec_fn misfeature in the future.

--
messages: 354238
nosy: gregory.p.smith
priority: high
severity: normal
stage: needs patch
status: open
title: Add support for settting umask in subprocess children
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue38414] Ordering a nested dictionary in python with json format

2019-10-08 Thread Umar Asghar


Change by Umar Asghar :


--
type:  -> enhancement

___
Python tracker 

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



[issue38414] Ordering a nested dictionary in python with json format

2019-10-08 Thread Umar Asghar


Umar Asghar  added the comment:

Please ignore the above shared sample data in the above code and consider this 
one.

this is the exact code that is misbehaving in python 2.7


# Sort nested dictionary by key
# using OrderedDict() + sorted()
from collections import OrderedDict
from operator import getitem
import json

# initializing dictionary
test_dict = {'3' : { 'roll' : 24, 'marks' : 17},
'2' : {'roll' : 54, 'marks' : 12},
'1' : { 'roll' : 12, 'marks' : 15}}

# printing original dict
print("The original dictionary : " + str(test_dict))

# using OrderedDict() + sorted()
# Sort nested dictionary by key
res = OrderedDict(sorted(test_dict.items(),
key = lambda x: getitem(x[1], 'marks')))

print("The sorted dictionary by marks is : " + str(res))
# Output
# The sorted dictionary by marks is : OrderedDict([('2', {'roll': 54, 'marks': 
12}), ('1', {'roll': 12, 'marks': 15}), ('3', {'roll': 24, 'marks': 17})])

res1 = json.dumps(res)

# print result
print("The sorted dictionary by marks is : (json)")
print(json.loads(res1))
# Output
# The sorted dictionary by marks is : (json)
# {u'1': {u'roll': 12, u'marks': 15}, u'3': {u'roll': 24, u'marks': 17}, u'2': 
{u'roll': 54, u'marks': 12}}

--
Added file: https://bugs.python.org/file48650/bug.py

___
Python tracker 

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



[issue38416] test_largefile.TestSocketSendfile.test_it() failed with 15 min timeout on AMD64 FreeBSD 10-STABLE Non-Debug 3.x

2019-10-08 Thread STINNER Victor


STINNER Victor  added the comment:

Another approach is to change the timeout of 15 min for this super slow 
buildbot. For example, set it to 20 min or 30 min.

--

___
Python tracker 

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



[issue38416] test_largefile.TestSocketSendfile.test_it() failed with 15 min timeout on AMD64 FreeBSD 10-STABLE Non-Debug 3.x

2019-10-08 Thread STINNER Victor


STINNER Victor  added the comment:

On the previous build, the test failed with timeout while other tests were 
running in parallel, and then the test passed ... in 14 min 43 seconds... which 
is very close to the limit of 15 minutes :-)

--

___
Python tracker 

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



[issue38416] test_largefile.TestSocketSendfile.test_it() failed with 15 min timeout on AMD64 FreeBSD 10-STABLE Non-Debug 3.x

2019-10-08 Thread STINNER Victor


New submission from STINNER Victor :

It seems like the 15 min timeout for the overall test_largefile is too short 
for the very slow AMD64 FreeBSD 10-STABLE Non-Debug 3.x buildbot.

The test creates two files of 2.5 GB on the disk.

One solution is to skip the test on this buildbot worker. For example, using a 
test resource like "largefile","cpu" resource, or another one. Maybe only skip 
TestSocketSendfile.test_it(), or even skip for the whole file. Currently, the 
whole file requires the "largefile" resource, but only on Windows and macOS.

Right now, the buildbot worker runs the test suite using:

   ./python  ./Tools/scripts/run_tests.py -j 1 -u all -W --slowest 
--fail-env-changed --timeout=900 -j2 -j4 

So all resources are enabled.

--

https://buildbot.python.org/all/#/builders/167/builds/1695

test_it (test.test_largefile.TestCopyfile) ... ok
Timeout (0:15:00)!
Thread 0x000806c95400 (most recent call first):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/test_largefile.py",
 line 193 in run
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/threading.py",
 line 882 in run
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/threading.py",
 line 944 in _bootstrap_inner
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/threading.py",
 line 902 in _bootstrap

Thread 0x000801c06400 (most recent call first):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/socket.py", 
line 386 in _sendfile_use_sendfile
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/socket.py", 
line 483 in sendfile
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/test_largefile.py",
 line 207 in test_it
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/unittest/case.py",
 line 616 in _callTestMethod
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/unittest/case.py",
 line 659 in run
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/unittest/case.py",
 line 719 in __call__
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/unittest/suite.py",
 line 122 in run
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/unittest/suite.py",
 line 84 in __call__
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/unittest/suite.py",
 line 122 in run
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/unittest/suite.py",
 line 84 in __call__
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/unittest/suite.py",
 line 122 in run
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/unittest/suite.py",
 line 84 in __call__
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/unittest/runner.py",
 line 176 in run
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/support/__init__.py",
 line 2032 in _run_suite
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/support/__init__.py",
 line 2128 in run_unittest
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/libregrtest/runtest.py",
 line 209 in _test_module
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/libregrtest/runtest.py",
 line 234 in _runtest_inner2
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/libregrtest/runtest.py",
 line 270 in _runtest_inner
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/libregrtest/runtest.py",
 line 153 in _runtest
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/libregrtest/runtest.py",
 line 193 in runtest
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/libregrtest/main.py",
 line 318 in rerun_failed_tests
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/libregrtest/main.py",
 line 691 in _main
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/libregrtest/main.py",
 line 634 in main
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/libregrtest/main.py",
 line 712 in main
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/test/__main__.py",
 line 2 in 
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/runpy.py", 
line 85 in _run_code
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10.nondebug/build/Lib/runpy.py", 
line 192 in _run_module_as_main
test_it (test.test_largefile.TestSocketSendfile) ... *** Error code 1

--
components: Tests
messages: 354234
nosy: giampaolo.rodola, pablogsal, vstinner
priority: normal
severity: normal
status: open
title: test_largefile.TestSocketSendfile.test_it() failed with 15 min timeout 
on AMD64 FreeBSD 10-STABLE Non-Debug 3.x
versions: Python 

[issue34957] Segementation faults on ARM and ARM64

2019-10-08 Thread Zachary Ware


Change by Zachary Ware :


--
resolution: works for me -> out of date
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



[issue38368] Crash when subclassing ctypes.Union

2019-10-08 Thread Vinay Sajip

Vinay Sajip  added the comment:


New changeset e8bedbddadaa86be6bd86dc32dbdbd53933a4988 by Vinay Sajip in branch 
'master':
bpo-38368: Added fix for ctypes crash when handling arrays in structs… 
(GH-16589)
https://github.com/python/cpython/commit/e8bedbddadaa86be6bd86dc32dbdbd53933a4988


--

___
Python tracker 

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



[issue38415] @asynccontextmanager decorated functions are not callable like @contextmanager

2019-10-08 Thread Jason Fried


Change by Jason Fried :


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

___
Python tracker 

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



[issue38415] @asynccontextmanager decorated functions are not callable like @contextmanager

2019-10-08 Thread Jason Fried


New submission from Jason Fried :

The standard contextmanager decorator produces a wrapper that itself can be 
used as a decorator

```
@contextmanager
def some_context():
...
yield

@some_context()
def some_function():
# we are inside a with some_context() now. 
...


```

When I created a version of asynccontextmanager internally before it was 
available in the  stdLib I copied this behavior and I have people internally to 
facebook using this behavior,  Was there a reason this behavior was not 
replicated to asynccontextmanager?  

I have a diff an tests to add

--
components: Library (Lib)
messages: 354232
nosy: fried, yselivanov
priority: normal
severity: normal
status: open
title: @asynccontextmanager decorated functions are not callable like 
@contextmanager
type: enhancement
versions: Python 3.7, 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



[issue38395] proxy_contains (weakref.proxy) can access an object with 0 refcount

2019-10-08 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
priority: release blocker -> normal

___
Python tracker 

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



[issue38395] proxy_contains (weakref.proxy) can access an object with 0 refcount

2019-10-08 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 526ef856dd598fd3cefdfadeb18ede7a8e57aa41 by Pablo Galindo in 
branch '3.8':
[3.8] bpo-38395: Fix ownership in weakref.proxy methods (GH-16632) (GH-16662)
https://github.com/python/cpython/commit/526ef856dd598fd3cefdfadeb18ede7a8e57aa41


--

___
Python tracker 

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



[issue38414] Ordering a nested dictionary in python with json format

2019-10-08 Thread Umar Asghar


Change by Umar Asghar :


--
versions: +Python 2.7 -Python 3.9

___
Python tracker 

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



[issue38409] Typo in doc string for str.strip

2019-10-08 Thread Hansraj Das


Change by Hansraj Das :


--
nosy: +hansrajdas

___
Python tracker 

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



[issue38414] Ordering a nested dictionary in python with json format

2019-10-08 Thread Umar Asghar


Umar Asghar  added the comment:

I have recently attached the file, please review it as a code reference.

--

___
Python tracker 

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



[issue38414] Ordering a nested dictionary in python with json format

2019-10-08 Thread Umar Asghar


Change by Umar Asghar :


Added file: https://bugs.python.org/file48649/test.py

___
Python tracker 

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



[issue38109] Missing constants in Lib/stat.py

2019-10-08 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue38414] Ordering a nested dictionary in python with json format

2019-10-08 Thread Umar Asghar


Umar Asghar  added the comment:

I guess it exists in all Python versions. I have tested in both Python 2 and 
Python 3.

Python 2.7.15+ (default, Jul  9 2019, 16:51:35) 
[GCC 7.4.0] on linux2

Python 3.6.8 (default, Aug 20 2019, 17:12:48) 
[GCC 8.3.0] on linux

--
versions: +Python 3.9

___
Python tracker 

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



[issue38414] Ordering a nested dictionary in python with json format

2019-10-08 Thread Umar Asghar


New submission from Umar Asghar :

Python does not preserve ordering in JSON format. I have tested it out but it's 
not working. Here is my code.

# Python3 code to demonstrate 
# Sort nested dictionary by key 
# using OrderedDict() + sorted() 
from collections import OrderedDict 
from operator import getitem 
import json

# initializing dictionary 
test_dict = {'Nikhil' : { 'roll' : 24, 'marks' : 17}, 
'Akshat' : {'roll' : 54, 'marks' : 12}, 
'Akash' : { 'roll' : 12, 'marks' : 15}} 

# printing original dict 
print("The original dictionary : " + str(test_dict)) 

# using OrderedDict() + sorted() 
# Sort nested dictionary by key 
res = OrderedDict(sorted(test_dict.items(), 
key = lambda x: getitem(x[1], 'marks'))) 

print("The sorted dictionary by marks is : " + str(res))
# Output
# The sorted dictionary by marks is : OrderedDict([('Akshat', {'marks': 12, 
'roll': 54}), ('Akash', {'marks': 15, 'roll': 12}), ('Nikhil', {'marks': 17, 
'roll': 24})])

res = json.dumps(res)

# print result 
print("The sorted dictionary by marks is : (json)")
print(json.loads(res)) 
# Output
# The sorted dictionary by marks is : 
# {'Akash': {'marks': 15, 'roll': 12}, 'Akshat': {'marks': 12, 'roll': 54}, 
'Nikhil': {'marks': 17, 'roll': 24}}
Does anyone suggest any solution for it?

It's different than a simple dictionary. It only targets the nested dictionary 
ordering. Please don't mark it a duplication of simple dictionary ordering with 
JSON. thanks

--
messages: 354228
nosy: Umar Asghar
priority: normal
severity: normal
status: open
title: Ordering a nested dictionary in python with json format

___
Python tracker 

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



[issue38307] Provide Class' end line in readmodule module

2019-10-08 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue38413] Remove or change "Multithreading" section

2019-10-08 Thread Vladimir Ryabtsev


New submission from Vladimir Ryabtsev :

This is regarding the page https://docs.python.org/3.7/library/sqlite3.html.

I believe this section on the very bottom of the page has been kept here for 
pretty long time, during that both SQLite and the sqlite3 module evolved and 
improved. Now the content contradicts to the description of function 
"connect()" in the part describing "check_same_thread" parameter. The function 
description says that using connections from multiple threads is allowed with 
serialization handled by the user (and it is true), while the bottom 
"Mutithreading" section says sharing connections is not allowed.

I think we can remove "Mutithreading" section entirely unless there is 
something important to add to what already mentioned.

--
assignee: docs@python
components: Documentation
messages: 354227
nosy: Vladimir Ryabtsev, docs@python
priority: normal
severity: normal
status: open
title: Remove or change "Multithreading" section
versions: Python 3.7, 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



[issue38307] Provide Class' end line in readmodule module

2019-10-08 Thread Aviral


Change by Aviral :


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

___
Python tracker 

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



[issue38109] Missing constants in Lib/stat.py

2019-10-08 Thread Ronan Lamy


Change by Ronan Lamy :


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

___
Python tracker 

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



[issue31722] _io.IncrementalNewlineDecoder doesn't inherit codecs.IncrementalDecoder

2019-10-08 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue31722] _io.IncrementalNewlineDecoder doesn't inherit codecs.IncrementalDecoder

2019-10-08 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue1724822] provide a shlex.split alternative for Windows shell syntax

2019-10-08 Thread Eli Schwartz


Change by Eli Schwartz :


--
nosy: +eschwartz

___
Python tracker 

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



[issue38216] Fix for issue30458 (HTTP Header Injection) prevents crafting invalid requests

2019-10-08 Thread Larry Hastings


Change by Larry Hastings :


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



[issue38216] Fix for issue30458 (HTTP Header Injection) prevents crafting invalid requests

2019-10-08 Thread Larry Hastings


Larry Hastings  added the comment:


New changeset 2784e78dc3445c6dd59e915d86c336374c1fa09a by larryhastings (Jason 
R. Coombs) in branch '3.5':
[3.5] bpo-38216, bpo-36274: Allow subclasses to separately override validation 
and encoding behavior (GH-16448) (#16475)
https://github.com/python/cpython/commit/2784e78dc3445c6dd59e915d86c336374c1fa09a


--

___
Python tracker 

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



[issue36274] http.client cannot send non-ASCII request lines

2019-10-08 Thread Larry Hastings


Larry Hastings  added the comment:


New changeset 2784e78dc3445c6dd59e915d86c336374c1fa09a by larryhastings (Jason 
R. Coombs) in branch '3.5':
[3.5] bpo-38216, bpo-36274: Allow subclasses to separately override validation 
and encoding behavior (GH-16448) (#16475)
https://github.com/python/cpython/commit/2784e78dc3445c6dd59e915d86c336374c1fa09a


--
nosy: +larry

___
Python tracker 

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



[issue38412] csv.reader failed to split string with spaces and quoted delimiter

2019-10-08 Thread belegnar


New submission from belegnar :

```
>>> list(csv.reader(['param1,"param21,param22",param3']))
[['param1', 'param21,param22', 'param3']]
>>> list(csv.reader(['param1, "param21,param22", param3']))
[['param1', ' "param21', 'param22"', ' param3']]
```

version 3.7.4 on linux

--
components: Library (Lib)
messages: 354224
nosy: belegnar
priority: normal
severity: normal
status: open
title: csv.reader failed to split string with spaces and quoted delimiter
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



[issue37531] Fix regrtest timeout for subprocesses: regrtest -jN --timeout=SECONDS

2019-10-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0ec618af98ac250a91ee9c91f8569e6df6772758 by Victor Stinner in 
branch 'master':
bpo-37531: regrtest ignores output on timeout (GH-16659)
https://github.com/python/cpython/commit/0ec618af98ac250a91ee9c91f8569e6df6772758


--

___
Python tracker 

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



[issue38207] subprocess: On Windows, Popen.kill() + Popen.communicate() is blocking until all processes using the pipe close the pipe

2019-10-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0ec618af98ac250a91ee9c91f8569e6df6772758 by Victor Stinner in 
branch 'master':
bpo-37531: regrtest ignores output on timeout (GH-16659)
https://github.com/python/cpython/commit/0ec618af98ac250a91ee9c91f8569e6df6772758


--

___
Python tracker 

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



[issue38294] Documentation on 3.6->3.7 re.escape no longer escaping "/" or ":" should be obvious

2019-10-08 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 43f5c0c4d0a608c04c3978adb45117f3943203b7 by Serhiy Storchaka 
(Ricardo Bánffy) in branch '3.7':
[3.7] bpo-38294: Add list of no-longer-escaped chars to re.escape 
documentation. (GH-16442) (GH-16647)
https://github.com/python/cpython/commit/43f5c0c4d0a608c04c3978adb45117f3943203b7


--

___
Python tracker 

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



[issue38411] SQLITE_MISUSE race condition in sqlite3 is misleadingly raised as a binding error

2019-10-08 Thread Jack Robison


Change by Jack Robison :


--
type:  -> behavior

___
Python tracker 

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



[issue38395] proxy_contains (weakref.proxy) can access an object with 0 refcount

2019-10-08 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +16245
pull_request: https://github.com/python/cpython/pull/16662

___
Python tracker 

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



[issue38395] proxy_contains (weakref.proxy) can access an object with 0 refcount

2019-10-08 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +16246
pull_request: https://github.com/python/cpython/pull/16663

___
Python tracker 

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



[issue38395] proxy_contains (weakref.proxy) can access an object with 0 refcount

2019-10-08 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +16244
pull_request: https://github.com/python/cpython/pull/16661

___
Python tracker 

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



[issue38410] Possible fatal errors due to _PyEval_SetAsyncGen{Finalizer, Firstiter}()

2019-10-08 Thread Steve Dower

Steve Dower  added the comment:

You're right, they need either your patch or PyErr_WriteUnraisable(NULL) before 
returning.

Łukasz - this needs a fix in 3.8, but we don't have to necessarily change the 
(internal, but exposed) ABI. For 3.9, we'll fix it properly, but for 3.8 I'll 
let you make the call whether we can also add a return value to these functions.

-PyAPI_FUNC(void) _PyEval_SetAsyncGenFirstiter(PyObject *);
+PyAPI_FUNC(int) _PyEval_SetAsyncGenFirstiter(PyObject *);
 PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFirstiter(void);
-PyAPI_FUNC(void) _PyEval_SetAsyncGenFinalizer(PyObject *);
+PyAPI_FUNC(int) _PyEval_SetAsyncGenFinalizer(PyObject *);

--
keywords: +newcomer friendly
nosy: +lukasz.langa
priority: normal -> release blocker

___
Python tracker 

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



[issue38395] proxy_contains (weakref.proxy) can access an object with 0 refcount

2019-10-08 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 10cd00a9e3c22af37c748ea5a417f6fb66601e21 by Pablo Galindo in 
branch 'master':
bpo-38395: Fix ownership in weakref.proxy methods (GH-16632)
https://github.com/python/cpython/commit/10cd00a9e3c22af37c748ea5a417f6fb66601e21


--

___
Python tracker 

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



[issue38410] Possible fatal errors due to _PyEval_SetAsyncGen{Finalizer, Firstiter}()

2019-10-08 Thread Zackery Spytz


New submission from Zackery Spytz :

_PyEval_SetAsyncGenFinalizer() and _PyEval_SetAsyncGenFirstiter() don't include 
proper error handling for their PySys_Audit() calls. This could lead to leaked 
exceptions and fatal errors.

--
components: Interpreter Core
messages: 354210
nosy: ZackerySpytz
priority: normal
severity: normal
status: open
title: Possible fatal errors due to _PyEval_SetAsyncGen{Finalizer,Firstiter}()
type: crash
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



[issue38411] SQLITE_MISUSE race condition in sqlite3 is misleadingly raised as a binding error

2019-10-08 Thread Jack Robison


New submission from Jack Robison :

There is a race condition in the sqlite3 module that is misleadingly raised as 
sqlite3.InterfaceError('Error binding parameter 0 - probably unsupported type.')

There are two issues here, one is the incorrectly raise error 
(https://bugs.python.org/issue16379), the other is the underlying SQLITE_MISUSE 
caused by the race condition. I believe this is a race between sqlite3 vs 
python garbage collection due to the releasing of the GIL. If the GIL releasing 
is removed from sqlite3, I cannot reproduce the race.

Here is a script to reproduce the error, as the number of runners or 
queries_per_executemany is increased the error happens more frequently. The 
minimal test case only needs two executemanys where each has two queries to run.





import asyncio
import sqlite3
from concurrent.futures.thread import ThreadPoolExecutor


async def misuse_sqlite(runners=2, queries_per_executemany=2):
loop = asyncio.get_event_loop()

expected_error = 'Error binding parameter 0 - probably unsupported type.'
exceptions = []
executor = ThreadPoolExecutor(1)
db = executor.submit(sqlite3.connect, ':memory:', 
isolation_level=None).result()
executor.submit(db.executescript, "create table test (id text primary 
key);")

def query_in_executor():
return asyncio.wrap_future(executor.submit(executemany))

def executemany():
try:
return db.executemany("select * from test where id=?", ((str(i),) 
for i in range(queries_per_executemany)))
except Exception as err:
exceptions.append(err)

for _ in range(runners):
loop.call_soon(query_in_executor)
await asyncio.sleep(0.01)

assert all(str(err) == expected_error and isinstance(err, 
sqlite3.InterfaceError) for err in exceptions)

executor.submit(db.close).result()
executor.shutdown()

return len(exceptions) > 0


attempts = 0

while True:
attempts += 1
if asyncio.run(misuse_sqlite()):
print('error hit on attempt', attempts)
break

--
components: Library (Lib)
messages: 354218
nosy: Jack Robison
priority: normal
severity: normal
status: open
title: SQLITE_MISUSE race condition in sqlite3 is misleadingly raised as a 
binding error
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



[issue36075] python 2to3 conversion tool is generating file with extra line for every input line

2019-10-08 Thread Mark Dickinson


Mark Dickinson  added the comment:

Closing as duplicate.

@sabakauser: if you update to a recent Python 3.7 (anything more recent than 
3.7.1 should be enough), you should find that this is fixed.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> 2to3 munges new lines on Windows

___
Python tracker 

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



[issue38202] A fatal error in test_dictviews

2019-10-08 Thread Dong-hee Na


Dong-hee Na  added the comment:

Can you finalize the PR 16241 by adding the unit test which @serhiy.storchaka 
suggested?

--
nosy: +corona10

___
Python tracker 

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



[issue38207] subprocess: On Windows, Popen.kill() + Popen.communicate() is blocking until all processes using the pipe close the pipe

2019-10-08 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue37531] Fix regrtest timeout for subprocesses: regrtest -jN --timeout=SECONDS

2019-10-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16242
pull_request: https://github.com/python/cpython/pull/16659

___
Python tracker 

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



[issue38409] Typo in doc string for str.strip

2019-10-08 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the patch and report. CPython now accepts GitHub pull requests 
https://devguide.python.org/pullrequest/

--
nosy: +xtreak

___
Python tracker 

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



[issue38410] Possible fatal errors due to _PyEval_SetAsyncGen{Finalizer, Firstiter}()

2019-10-08 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +steve.dower

___
Python tracker 

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



[issue36075] python 2to3 conversion tool is generating file with extra line for every input line

2019-10-08 Thread Mark Dickinson


Mark Dickinson  added the comment:

Looks like a duplicate of #34108

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue38379] finalizer resurrection in gc

2019-10-08 Thread Tim Peters


Tim Peters  added the comment:

PR 16658 aims to repair the stats reported.

--

___
Python tracker 

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



[issue38379] finalizer resurrection in gc

2019-10-08 Thread Tim Peters


Change by Tim Peters :


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

___
Python tracker 

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



[issue38407] Add docstrings for typing.SupportsXXX classes

2019-10-08 Thread miss-islington


miss-islington  added the comment:


New changeset 7162440a7247f77d22cd937143f358fd5ac85af4 by Miss Islington (bot) 
in branch '3.8':
bpo-38407: Add docstrings for typing.SupportsXXX classes. (GH-16644)
https://github.com/python/cpython/commit/7162440a7247f77d22cd937143f358fd5ac85af4


--
nosy: +miss-islington

___
Python tracker 

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



[issue38405] Nested subclasses of typing.NamedTuple are not pickleable

2019-10-08 Thread miss-islington


miss-islington  added the comment:


New changeset 10b475a151dc35c8ca4047331d591130973e914d by Miss Islington (bot) 
in branch '3.8':
bpo-38405: Make nested subclasses of typing.NamedTuple pickleable. (GH-16641)
https://github.com/python/cpython/commit/10b475a151dc35c8ca4047331d591130973e914d


--
nosy: +miss-islington

___
Python tracker 

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



[issue38410] Possible fatal errors due to _PyEval_SetAsyncGen{Finalizer, Firstiter}()

2019-10-08 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue38409] Typo in doc string for str.strip

2019-10-08 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +newcomer friendly

___
Python tracker 

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



[issue38409] Typo in doc string for str.strip

2019-10-08 Thread Bob Dowling


New submission from Bob Dowling :

The doc string for str.strip() has a typo: the "d" at the end of "removed" is 
missing.

help(str.strip)

Currently:
Return a copy of the string with leading and trailing whitespace remove.

Should be:
Return a copy of the string with leading and trailing whitespace removed.

I have attached an offered patch.

--
components: Library (Lib)
files: str_strip.patch
keywords: patch
messages: 354209
nosy: Bob Dowling
priority: normal
severity: normal
status: open
title: Typo in doc string for str.strip
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48648/str_strip.patch

___
Python tracker 

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



[issue38118] Valgrind warning in PyUnicode_Decode: false alarm with GCC builtin strcmp()

2019-10-08 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, the issue has been fixed in 3.7, 3.8 and master branches.

Ensure that you use Valgrind with Misc/valgrind.supp. Example:

$ echo|PYTHONMALLOC=malloc valgrind --suppressions=Misc/valgrind-python.supp 
./python Lib/tokenize.py
(...)
==12923== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 1 from 1)

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



[issue38118] Valgrind warning in PyUnicode_Decode: false alarm with GCC builtin strcmp()

2019-10-08 Thread miss-islington


miss-islington  added the comment:


New changeset 98043b4fcd80bdfa8cc2be1730fa2a4cf4950958 by Miss Islington (bot) 
in branch '3.7':
bpo-38118: Ignore Valgrind false alarm in PyUnicode_Decode() (GH-16651)
https://github.com/python/cpython/commit/98043b4fcd80bdfa8cc2be1730fa2a4cf4950958


--

___
Python tracker 

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



[issue38407] Add docstrings for typing.SupportsXXX classes

2019-10-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16239
pull_request: https://github.com/python/cpython/pull/16656

___
Python tracker 

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



[issue38405] Nested subclasses of typing.NamedTuple are not pickleable

2019-10-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16238
pull_request: https://github.com/python/cpython/pull/16655

___
Python tracker 

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



[issue38118] Valgrind warning in PyUnicode_Decode: false alarm with GCC builtin strcmp()

2019-10-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16237
pull_request: https://github.com/python/cpython/pull/16654

___
Python tracker 

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



[issue38118] Valgrind warning in PyUnicode_Decode: false alarm with GCC builtin strcmp()

2019-10-08 Thread miss-islington


miss-islington  added the comment:


New changeset 364532fb4962991d278da6470c3aec4e443e533d by Miss Islington (bot) 
in branch '3.8':
bpo-38118: Ignore Valgrind false alarm in PyUnicode_Decode() (GH-16651)
https://github.com/python/cpython/commit/364532fb4962991d278da6470c3aec4e443e533d


--
nosy: +miss-islington

___
Python tracker 

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



[issue38118] Valgrind warning in PyUnicode_Decode: false alarm with GCC builtin strcmp()

2019-10-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16235
pull_request: https://github.com/python/cpython/pull/16652

___
Python tracker 

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



[issue38118] Valgrind warning in PyUnicode_Decode: false alarm with GCC builtin strcmp()

2019-10-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16236
pull_request: https://github.com/python/cpython/pull/16653

___
Python tracker 

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



[issue38118] Valgrind warning in PyUnicode_Decode: false alarm with GCC builtin strcmp()

2019-10-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 03ab6b4fc6f59a4452756e7a3a46310ce30ec4b2 by Victor Stinner in 
branch 'master':
bpo-38118: Ignore Valgrind false alarm in PyUnicode_Decode() (GH-16651)
https://github.com/python/cpython/commit/03ab6b4fc6f59a4452756e7a3a46310ce30ec4b2


--

___
Python tracker 

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



[issue38405] Nested subclasses of typing.NamedTuple are not pickleable

2019-10-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 13abda41003daf599587991d8291f0dacf6e9519 by Serhiy Storchaka in 
branch 'master':
bpo-38405: Make nested subclasses of typing.NamedTuple pickleable. (GH-16641)
https://github.com/python/cpython/commit/13abda41003daf599587991d8291f0dacf6e9519


--

___
Python tracker 

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



[issue38407] Add docstrings for typing.SupportsXXX classes

2019-10-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 8252c52e57283515ace5d4251584255dc5c60eb5 by Serhiy Storchaka in 
branch 'master':
bpo-38407: Add docstrings for typing.SupportsXXX classes. (GH-16644)
https://github.com/python/cpython/commit/8252c52e57283515ace5d4251584255dc5c60eb5


--

___
Python tracker 

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



[issue38118] Valgrind warning in PyUnicode_Decode: false alarm with GCC builtin strcmp()

2019-10-08 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like Python 2.7 is not affected.

--
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue38118] Valgrind warning in PyUnicode_Decode: false alarm with GCC builtin strcmp()

2019-10-08 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +16234
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/16651

___
Python tracker 

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



[issue36356] Failure to build with address sanitizer

2019-10-08 Thread STINNER Victor


STINNER Victor  added the comment:

> The default build of python with ASAN builds successfully. Test suite and PGO 
> build are currently blocked, but that can be separated if it makes more sense 
> to handle them individually.

Yeah, please open one issue per ASAN issue (try to group similar warnings in 
the same Python issue?).


> Would it make sense to add an ASAN build to the CI pipeline to make detection 
> automatic going forward?

Gregory maintains a clang UBSan buildbot:
https://buildbot.python.org/all/#/builders/135

Usually I prefer to setup a buildbot when most issues are fixed.

I close this 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



[issue36356] Failure to build with address sanitizer

2019-10-08 Thread Yury Selivanov


Change by Yury Selivanov :


--
nosy:  -yselivanov

___
Python tracker 

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



[issue36356] Failure to build with address sanitizer

2019-10-08 Thread Ben Harper


Ben Harper  added the comment:

The default build of python with ASAN builds successfully. Test suite and PGO 
build are currently blocked, but that can be separated if it makes more sense 
to handle them individually.

Would it make sense to add an ASAN build to the CI pipeline to make detection 
automatic going forward?

--

___
Python tracker 

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



[issue33803] contextvars: hamt_alloc() must initialize h_root and h_count fields

2019-10-08 Thread Yury Selivanov


Yury Selivanov  added the comment:

> In bpo-38392, I modified PyObject_GC_Track() in debug mode to detect this bug.

Awesome!!!

--

___
Python tracker 

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



[issue36253] Use after free in ctypes test suite

2019-10-08 Thread Ben Harper


Ben Harper  added the comment:

Changes merged

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



[issue38118] Valgrind warning in PyUnicode_Decode: false alarm with GCC builtin strcmp()

2019-10-08 Thread STINNER Victor


STINNER Victor  added the comment:

The valgrind false alarm on GCC builtin strcmp() has been reported to the 
Valgrind bug tracker in 2011, with an update in 2012 and... nothing :-(
https://bugs.kde.org/show_bug.cgi?id=264936

curl worked around the issue by disabling valgrind on the impacted test:
https://lists.fedoraproject.org/pipermail/scm-commits/2011-February/567665.html

Passing "--partial-loads-ok=yes" to Valgrind has no effect... It became the 
default:
http://valgrind.org/docs/manual/mc-manual.html#opt.partial-loads-ok

--

___
Python tracker 

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



[issue38408] urlparse gives no method to build a url with a port

2019-10-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

One way I can think of doing this in a backward compatible way is to add 
keyword parameters to urlunparse, like:

def urlunparse(components, *, username=None, password=None, hostname=None, 
port=None):

Which would make your call:
site_to_test = urllib.parse.urlunparse((scheme, host, page, '', '', ''), 
port=9097)

I think that's a horrible interface, but it is backward compatible.

A better interface would be have all 10 URL parameters passed in as keyword 
arguments, with reasonable defaults. If you want to keep this named 
"urlunparse", you'd need to say you can't pass in both "components" and any 
other named parameter (other than maybe the 4  parameters that are unnamed in 
ParseResult).

Something like:
def urlunparse(components=None, scheme=None, netloc=None, path=None, 
params=None, query=None, fragment=None, *, username=None, password=None, 
hostname=None, port=None):

Then error if components is set and any of scheme, netloc, path, params, query, 
or fragment is also set.

We could bikeshed about which would be keyword-only, if any, all, or only some 
as I've shown here.

Another option would be to leave urlunparse alone, and add a new function 
entirely, which wouldn't have to worry about backward compatibility.

It might be worthwhile to raise this on python-ideas.

--
nosy: +eric.smith

___
Python tracker 

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



[issue38140] Py_tp_dictoffset / Py_tp_finalize are unsettable in stable API

2019-10-08 Thread Petr Viktorin


Petr Viktorin  added the comment:

Thank you all!

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



[issue37879] Segfaults in C heap type subclasses

2019-10-08 Thread Petr Viktorin

Petr Viktorin  added the comment:

Thanks to Stéphane and Eddie for fixing the refleak!

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



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

2019-10-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

And with PR 16583 it is now completely fixed. I.e. it can only fail in cases 
when the regular interactive interpreter fails too.

--
resolution:  -> fixed
stage: needs patch -> 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



[issue36698] Shell restart when error message contains non-BMP characters

2019-10-08 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue38401] Make dataclass attribute docstrings accessible

2019-10-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

Note that those strings are not docstrings, per se. They're just strings, and 
aren't available in the class definition for the dataclass decorator to see. 
It's really no different from:

class X:
x: int
3

That 3 just gets evaluated and thrown away, like the strings in your example. 
To change this is beyond the scope of dataclasses, and would need to be a 
language change. I can't think of a good way to attach the string to the 
annotation before it (I'm assuming this would only work with annotations, but 
maybe you have other ideas). You might want to bring this up on python-ideas to 
get some more feedback.

--

___
Python tracker 

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



[issue36698] Shell restart when error message contains non-BMP characters

2019-10-08 Thread miss-islington


miss-islington  added the comment:


New changeset 4f962ecfa1aadc45facc250841208f6dd2ce690f by Miss Islington (bot) 
in branch '3.7':
bpo-36698: IDLE no longer fails when write non-encodable characters to stderr. 
(GH-16583)
https://github.com/python/cpython/commit/4f962ecfa1aadc45facc250841208f6dd2ce690f


--

___
Python tracker 

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



  1   2   >