[issue42227] Unexpected sharing of list/set/dict between instances of the same class, when the list/set/dict is a default parameter value of the constructor

2020-10-31 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

See also my comment here:

https://bugs.python.org/msg361451

--

___
Python tracker 

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



[issue42227] Unexpected sharing of list/set/dict between instances of the same class, when the list/set/dict is a default parameter value of the constructor

2020-10-31 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Sorry, this is not a bug, but working as designed. Default values for functions 
and methods are only created once, when the function is created, not on every 
call.

This is a FAQ:

https://docs.python.org/3/faq/programming.html#why-are-default-values-shared-between-objects

--
nosy: +steven.daprano
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



[issue42146] subprocess.Popen() leaks cwd in case of uid/gid overflow

2020-10-31 Thread Gregory P. Smith


Change by Gregory P. Smith :


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

___
Python tracker 

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



[issue42146] subprocess.Popen() leaks cwd in case of uid/gid overflow

2020-10-31 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset d3b4e068077dd26927ae7485bd0303e09d962c02 by Alexey Izbyshev in 
branch 'master':
bpo-42146: Unify cleanup in subprocess_fork_exec() (GH-22970)
https://github.com/python/cpython/commit/d3b4e068077dd26927ae7485bd0303e09d962c02


--

___
Python tracker 

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



[issue42227] Unexpected sharing of list/set/dict between instances of the same class, when the list/set/dict is a default parameter value of the constructor

2020-10-31 Thread Kaiyu Zheng


New submission from Kaiyu Zheng :

In the following toy example, with Python 3.7.4

class Foo:
def __init__(self, a=set()):
self.a = a
foo1 = Foo()
foo2 = Foo()
foo1.a.add(1)
print(foo2.a)

This shows {1}. This means that modifying the .a field of foo1 changed that of 
foo2. I was not expecting this behavior, as I thought that when the constructor 
is called, an empty set is created for the parameter `a`. But instead, what 
seems to happen is that a set() is created, and then shared between instances 
of Foo. What is the reason for this? What is the benefit? It adds a lot of 
confusion

--
messages: 380115
nosy: kaiyutony
priority: normal
severity: normal
status: open
title: Unexpected sharing of list/set/dict between instances of the same class, 
when the list/set/dict is a default parameter value of the constructor
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



[issue42226] imghdr.what is missing docstring, has a logic error, and is overly complex

2020-10-31 Thread Jeremy Howard


Change by Jeremy Howard :


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

___
Python tracker 

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



[issue42226] imghdr.what is missing docstring, has a logic error, and is overly complex

2020-10-31 Thread Jeremy Howard


New submission from Jeremy Howard :

imghdr.what does not set f if h is passed, but still passed f to tests 
functions. None of the tests functions use it - they would not be able to 
anyway since it is not always set.

imghdr.what is missing a docstring.

imghdr.what has a complex highly nest structure with multiple return paths 
which makes the logic hard to follow.

--
components: Library (Lib)
messages: 380114
nosy: jph00
priority: normal
severity: normal
status: open
title: imghdr.what is missing docstring, has a logic error, and is overly 
complex
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue42218] SystemError in compile builtin function

2020-10-31 Thread Zac Hatfield-Dodds


Zac Hatfield-Dodds  added the comment:

Wow!  Thanks and congrats on the super-fast fix :-)


FYI Paul Ganssle has recently [1] started to work on adding property-based 
tests to CPython CI [2].  Once Paul gets the stubs and first set of tests 
working, I'll start moving the others over from my demo repo [3] to CPython 
master so we catch this kind of bug earlier in future.

[1] https://bugs.python.org/issue42109; see also 
https://bugs.python.org/issue38953
[2] https://pyfound.blogspot.com/2020/05/property-based-testing-for-python.html
[3] https://github.com/Zac-HD/stdlib-property-tests

--

___
Python tracker 

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



[issue42225] Tkinter hangs or crashes when displaying astral chars

2020-10-31 Thread Terry J. Reedy


New submission from Terry J. Reedy :

On my macOS Mohave, 3.10, echoing '\U0001' (# = hex digit) or chr(#) 
(decimal digits) in IDLE's shell either prints an error box or hangs.  On 
#13153, freezing on macOS was reported for 3.7.6.  Until tkinter on Mac works 
better, we should try to get an error box for all astral chars.

For an SO questioner with Ubuntu 18.04, now updated to 20.04 with python 3.8.6, 
some chars display (128512-128547; 128549-128555; 128557-128576, example 
chr(128516)) and some 'crash' (example chr(128077)).  I am trying to get 
'crash' narrowed down and the tk version Ubuntu uses.
Serhiy, does >>> chr(128516) echo thumbs up on your Linux?

The SO crash example works for me on Windows.  I should test more codepoints.

--
components: Tkinter, Unicode, macOS
messages: 380112
nosy: ezio.melotti, ned.deily, ronaldoussoren, serhiy.storchaka, terry.reedy, 
vstinner
priority: normal
severity: normal
stage: test needed
status: open
title: Tkinter hangs or crashes when displaying astral chars
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

10**9 isn't much harder than 10E9 ;-)

--

___
Python tracker 

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



[issue14219] make the Classes tutorial more gentle

2020-10-31 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.2, Python 3.3, Python 
3.4

___
Python tracker 

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



[issue763043] unable to specify another compiler

2020-10-31 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.2

___
Python tracker 

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



[issue42160] unnecessary overhead in tempfile

2020-10-31 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +21987
pull_request: https://github.com/python/cpython/pull/23068

___
Python tracker 

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



[issue41835] Speed up dict vectorcall creation using keywords

2020-10-31 Thread Inada Naoki


Inada Naoki  added the comment:

> It should *not* be affected by the change. Anyway, I run the bench other 10 
> times, and the lowest value with the CPython code without the PR is not lower 
> than 67.7 ns. With the PR, it reaches 53.5 ns. And I do not understand why.

The benchmark is very affected by code placement.
Even adding dead function affects speeds. Read vstinner's blog and presentation:

* https://vstinner.github.io/journey-to-stable-benchmark-deadcode.html
* https://speakerdeck.com/haypo/how-to-run-a-stable-benchmark?slide=9

That's why we recommend PGO+LTO build for benchmarking.

--

___
Python tracker 

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



[issue2604] doctest.DocTestCase fails when run repeatedly

2020-10-31 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue12953] Function calls missing from profiler output

2020-10-31 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.9 -Python 3.2, Python 3.3

___
Python tracker 

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



[issue40077] Convert static types to heap types: use PyType_FromSpec()

2020-10-31 Thread STINNER Victor


STINNER Victor  added the comment:

Count static types:

grep -E 'static PyTypeObject .* =' $(find -name "*.c"|grep -v Doc/)|wc -l

Count heap types:

grep -E 'PyType_Spec .* =' $(find -name "*.c")|wc -l

Status:

* 3.6: 10 heap (6%) vs 145 static (total: 155)
* 3.7: 10 heap (6%) vs 150 static (total: 160)
* 3.8: 15 heap (9%) vs 157 static (total: 172)
* 3.9: 39 heap (21%) vs 149 static (total: 188) -- 2.6x more heap types than 
3.8!
* master: 69 heap (35%) vs 131 static (total: 200) -- 1.8x more heap types than 
3.9!

The percentage of heap static is growing in the right direction ;-) The total 
number of types is also growing at each Python realease!

--

___
Python tracker 

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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2020-10-31 Thread STINNER Victor


STINNER Victor  added the comment:

FYI I'm also using https://pythondev.readthedocs.io/subinterpreters.html to 
track the progress on isolating subinterpreters.

--

___
Python tracker 

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



[issue26377] Tkinter dialogs will not close if root window not packed.

2020-10-31 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Looking at #26376 again, I think Ned's msg260413 identified Sam's problem.  
"Also note that installing ActiveTcl 8.6.x has no effect if the tkinter in use 
was linked with an 8.5 version of Tcl/Tk, as the one you are using apparently 
was. Make sure you have installed the latest version of ActiveTcl 8.5.x and try 
again."  Sam's tk 8.5 would have been Apple's buggy 8.5.9 (or earlier).  I 
should have asked for the 8.y.z version listed in About IDLE.

In any case, I also verified no problem in current Python-Tk-IDLE.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Tkinter root window won't close if packed.

___
Python tracker 

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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2020-10-31 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue42223] List repetition operator gives unexpected results

2020-10-31 Thread Austin Green


Austin Green  added the comment:

Thanks for that; I suspected as much.  Could not find anything about it 
searching the web, so it's a feature not much discussed by the numerous Python 
tutorials.

--

___
Python tracker 

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



[issue40533] [subinterpreters] Don't share Python objects between interpreters

2020-10-31 Thread STINNER Victor


STINNER Victor  added the comment:

> For example, PyModule_Type is declared statically and so shared by all 
> interpreters and so PyModule_Type.tp_mro tuple is accessed in parallel by 
> multiple interpreters.

Another example of this issue are parallel Py_INCREF/Py_DECREF calls on the 
tp_bases member of a type.

--

___
Python tracker 

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



[issue40514] [subinterpreters] Add --experimental-isolated-subinterpreters build option

2020-10-31 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



[issue42224] test_format:test_locale fails when locale does not set grouping in thousands

2020-10-31 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


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

___
Python tracker 

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



[issue42224] test_format:test_locale fails when locale does not set grouping in thousands

2020-10-31 Thread Lysandros Nikolaou

New submission from Lysandros Nikolaou :

test_format:test_locale tests for the existence of the thousands separator in a 
formatted number.

However, my locale does not expect/enforce (not sure what the correct term is) 
grouping the number in thousands, which leads to the test (and consequently the 
whole test suite) failing:

➜  cpython git:(test-format-locale-fix) ./python  
Python 3.10.0a1+ (heads/master:3bf0d02f28, Oct 31 2020, 22:42:09) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
'LC_CTYPE=en_US.UTF-8;LC_NUMERIC=el_GR.UTF-8;LC_TIME=el_GR.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=el_GR.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=el_GR.UTF-8;LC_NAME=el_GR.UTF-8;LC_ADDRESS=el_GR.UTF-8;LC_TELEPHONE=el_GR.UTF-8;LC_MEASUREMENT=el_GR.UTF-8;LC_IDENTIFICATION=el_GR.UTF-8'
>>> format(123456789, 'n')
'123456789'
>>> locale.localeconv()['grouping']
[]

I guess the fix here is to check whether grouping is empty or not in 
test_locale.

--
components: Tests
messages: 380104
nosy: lys.nikolaou
priority: normal
severity: normal
status: open
title: test_format:test_locale fails when locale does not set grouping in 
thousands
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue42223] List repetition operator gives unexpected results

2020-10-31 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is not a bug. The sequence repetition operator does not *copy* items, as 
explained here:

https://docs.python.org/3/library/stdtypes.html#common-sequence-operations

--
nosy: +steven.daprano
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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2020-10-31 Thread STINNER Victor


STINNER Victor  added the comment:

> * _PyLong_Zero and _PyLong_One singletons are shared

Removed by bpo-42161 (commit c310185c081110741fae914c06c7aaf673ad3d0d).

--

___
Python tracker 

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



[issue42223] List repetition operator gives unexpected results

2020-10-31 Thread Austin Green


New submission from Austin Green :

Not sure if this is a bug, cannot find any clarification in the documentation.  
Please reassign it if need be.

Using the * operator to generate a list of lists:
>>> a = [[0]*3]*3
>>> a
[[0, 0, 0], [0, 0, 0], [0, 0, 0]]
gives a list of 3 lists of zeroes, as expected.
But the data values appear to be shared, so e.g.
>>> a[1][1] = 'spam'
>>> a
[[0, 'spam', 0], [0, 'spam', 0], [0, 'spam', 0]]
Not what I was expecting!

A list comprehension gives the results I wanted:
>>> a = [[0 for x in range(3)] for x in range(3)]
>>> a
[[0, 0, 0], [0, 0, 0], [0, 0, 0]]
Looks just the same, but:
>>> a[1][1] = 'spam'
>>> a
[[0, 0, 0], [0, 'spam', 0], [0, 0, 0]]
gives a different result, and is actually what I was expecting from the first 
example.

--
components: Interpreter Core
messages: 380101
nosy: austin.green
priority: normal
severity: normal
status: open
title: List repetition operator gives unexpected results
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue42186] unittest overrides more serious warnings filter added before unittest.main()

2020-10-31 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



[issue34704] Do not access ob_type directly, introduce Py_TP

2020-10-31 Thread STINNER Victor


STINNER Victor  added the comment:

> This has been resolved using Py_TYPE() and Py_SET_TYPE().

Great!

--

___
Python tracker 

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



[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Vedran Čačić

Vedran Čačić  added the comment:

Yes, the ability to write randrange(1e9) is sometimes nice. And the fact that 
it might give the number outside the intended range with probability 1e-17 is 
not really an important argument (people have bad intuitions about very small 
probabilities). But if we intend to be consistent with range, then of course 
this must go.

--
nosy: +veky

___
Python tracker 

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



[issue42198] Clean up docs for Union and GenericAlias

2020-10-31 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks Ken Ji for all your help! I'll close this now.

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



[issue42198] Clean up docs for Union and GenericAlias

2020-10-31 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 3bf0d02f2817c48b6ee61a95b52a6d76ad543be9 by kj in branch 'master':
bpo-42198: New section in stdtypes for type annotation types (GH-23063)
https://github.com/python/cpython/commit/3bf0d02f2817c48b6ee61a95b52a6d76ad543be9


--

___
Python tracker 

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



[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

User feedback concur with making the change:  
https://twitter.com/raymondh/status/1322607969754775552

--

___
Python tracker 

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



[issue37319] Deprecate using random.randrange() with non-integers

2020-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See issue4.

As a side effect this change provides 10% speed up (which can be lager after 
the end of the deprecation period).

--

___
Python tracker 

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



[issue34106] Add --with-module-config= to 'configure' script

2020-10-31 Thread Neil Schemenauer


Change by Neil Schemenauer :


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



[issue34704] Do not access ob_type directly, introduce Py_TP

2020-10-31 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

This has been resolved using Py_TYPE() and Py_SET_TYPE().

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



[issue27377] Add socket.fdtype()

2020-10-31 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

I believe this is not needed anymore.  Closing.

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

___
Python tracker 

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



[issue37319] Deprecate using random.randrange() with non-integers

2020-10-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution: rejected -> 
stage: resolved -> patch review
status: closed -> open
versions: +Python 3.10 -Python 3.9

___
Python tracker 

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



[issue31504] Documentation for return value for string.rindex is missing when search string is empty

2020-10-31 Thread Vedran Čačić

Vedran Čačić  added the comment:

Maybe you would use 5, but I would use 7 and get the same result. If the docs 
say "X.rindex(Y) == i means i is the highest index where Y is found in X", and 
"Y is found in X at i" is interpreted as "X[i:i+len(Y)] == Y" (as Serhiy said), 
then there is no such (highest) index.

I understand what _you_'re saying, but please understand that the docs do not 
say anything like that.

--

___
Python tracker 

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



[issue42221] Potential memory leak in resize_compact() (for unicode objects)

2020-10-31 Thread Daniel Alley


Daniel Alley  added the comment:

A helpful user in the discord was able to point out where the bug was - in our 
extension, but not directly apparent from the valgrind output.

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



[issue42218] SystemError in compile builtin function

2020-10-31 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


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



[issue42218] SystemError in compile builtin function

2020-10-31 Thread miss-islington


miss-islington  added the comment:


New changeset cfcb952e30e01d7cce430829af8edc7afc94e0b1 by Lysandros Nikolaou in 
branch '3.9':
[3.9] bpo-42218: Correctly handle errors in left-recursive rules (GH-23065) 
(GH-23066)
https://github.com/python/cpython/commit/cfcb952e30e01d7cce430829af8edc7afc94e0b1


--
nosy: +miss-islington

___
Python tracker 

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



[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think and always thought that integer domain functions should not accept 
non-integer arguments even with integer value. This is why I submitted numerous 
patches for deprecating and finally removing support of non-integer arguments 
in most of integer domain functions. C implemented functions which use 
PyArg_Parse("i") or PyLong_AsLong() for parsing arguments use now index() 
instead of int(). They emit a deprecation warning for non-integers in 3.8 and 
3.9 and raise type error since 3.10. math.factorial() emits a warning only in 
3.9.

Issue37319 (sorry, I wrote incorrect issue number in msg380085) was initially 
opened for 3.9, so we could convert warnings into errors in 3.10 or 3.11.

Currently randrange(1e25) can return value larger than 10**25, because 
int(1e25) == 1905969664 > 10**25.

--

___
Python tracker 

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



[issue42218] SystemError in compile builtin function

2020-10-31 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
pull_requests: +21985
pull_request: https://github.com/python/cpython/pull/23066

___
Python tracker 

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



[issue31504] Documentation for return value for string.rindex is missing when search string is empty

2020-10-31 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> rejected
stage: patch review -> resolved
status: pending -> closed
type: enhancement -> behavior

___
Python tracker 

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



[issue42218] SystemError in compile builtin function

2020-10-31 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:


New changeset 02cdfc93f82fecdb7eae97a868d4ee222b9875d9 by Lysandros Nikolaou in 
branch 'master':
bpo-42218: Correctly handle errors in left-recursive rules (GH-23065)
https://github.com/python/cpython/commit/02cdfc93f82fecdb7eae97a868d4ee222b9875d9


--

___
Python tracker 

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



[issue40350] modulefinder chokes on numpy - dereferencing None in spec.loader

2020-10-31 Thread Denis Kasak


Denis Kasak  added the comment:

Anything still left to do that is stalling this? I just got bitten by it when 
trying to use modulefinder.

--
nosy: +dkasak

___
Python tracker 

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



[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> These propositions were rejected by you. 
> Have you reconsidered your decision?

I was reluctant to break any existing code.
Now, I'm unsure and am inclined to harmonize it with range().

What do you think?
Should we have ever supported float arguments
for an integer domain function?

--

___
Python tracker 

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



[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It changes the behavior. Currently randrange(10.0) works, but with PR 23064 it 
would fail.

See issue40046 with a ready PR for increasing coverage for the random module. 
If it would accepted, some tests would fail with PR 23064.

If you want to deprecate accepting float arguments, there was issue40046 with a 
ready PR.

These propositions were rejected by you. Have you reconsidered your decision?

--

___
Python tracker 

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



[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I had forgotten. It looks like float arguments were allowed:

>>> randrange(10.0, 20.0, 2.0)
16

Is this worth going through a deprecation cycle to get the code cleaned-up or 
should we live with it as is?

--

___
Python tracker 

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



[issue42218] SystemError in compile builtin function

2020-10-31 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
nosy: +lys.nikolaou
nosy_count: 3.0 -> 4.0
pull_requests: +21984
pull_request: https://github.com/python/cpython/pull/23065

___
Python tracker 

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



[issue40814] Update typing module documentation based on PEP 585

2020-10-31 Thread Guido van Rossum


Change by Guido van Rossum :


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



[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

And, if we were willing to correct the exception type from ValueError to 
TypeError, the code could be made simpler, faster, and more in line with user 
expectations.

--

___
Python tracker 

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



[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue42222] Modernize integer test/conversion in randrange()

2020-10-31 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Move the int(x)==x test and conversion into the C code for operator.index().

--
components: Library (Lib)
messages: 380082
nosy: rhettinger, serhiy.storchaka, tim.peters
priority: normal
severity: normal
status: open
title: Modernize integer test/conversion in randrange()
versions: Python 3.10

___
Python tracker 

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



[issue42192] Python Windows .exe Installer ignores /TargetDir if there is an existing installation

2020-10-31 Thread Martin Gfeller


Martin Gfeller  added the comment:

Thanks again Steve. 

I will copy the installation. I require a lot of pip packaged, so the 
embeddable distro doesn't look right for my case. 

I still think the /targetdir should issue some kind of warning if used with an 
existing installation, but this is obviously lowest prio.

--

___
Python tracker 

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



[issue40814] Update typing module documentation based on PEP 585

2020-10-31 Thread Ken Jin


Ken Jin  added the comment:

IMO, this can now be closed.

Most code examples in typing were changed to builtin generics:
https://github.com/python/cpython/commit/d9ab95ff1fe81efdf70e545d536d9f6927d1ba81
https://github.com/python/cpython/commit/7f54e563dc150cd670ca8df678437455c3a7f2cd

Docs for PEP 585's GenericAlias was added:
https://github.com/python/cpython/commit/4173320920706b49a004b8d7108e8984e3fc

Dict, List, and friends were also all marked as deprecated in 3.9.

--

___
Python tracker 

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



[issue42173] Drop Solaris support

2020-10-31 Thread Apostolos Syropoulos


Apostolos Syropoulos  added the comment:

I think this is really a bad idea. I am using OpenIndiana in my classrooms and 
I teach Python! So if your drop Solaris support, it means I have to install a 
new supported OS on my many systems, to learn and teach many things, etc, This 
will make my life extremely difficult.

--
nosy: +ijdt.editor

___
Python tracker 

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



[issue41835] Speed up dict vectorcall creation using keywords

2020-10-31 Thread Marco Sulla


Marco Sulla  added the comment:

Well, actually Serhiy is right, it does not seem that the macro benchs did show 
something significant. Maybe the code can be used in other parts of CPython, 
for example in _pickle, where dicts are loaded. But it needs also to expose, 
maybe internally only, dictresize() and DICT_NEXT_VERSION(). Not sure it's 
something desirable.

There's something that I do not understand: the speedup to unpack_sequence. I 
checked the pyperformance code, and it's a microbench for:

a, b = some_sequence

It should *not* be affected by the change. Anyway, I run the bench other 10 
times, and the lowest value with the CPython code without the PR is not lower 
than 67.7 ns. With the PR, it reaches 53.5 ns. And I do not understand why. 
Maybe it affects the creation of the dicts with the local and global vars?

--

___
Python tracker 

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



[issue42198] Clean up docs for Union and GenericAlias

2020-10-31 Thread Ken Jin


Change by Ken Jin :


--
pull_requests: +21982
pull_request: https://github.com/python/cpython/pull/23063

___
Python tracker 

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



[issue42221] Potential memory leak in resize_compact() (for unicode objects)

2020-10-31 Thread Daniel Alley


New submission from Daniel Alley :

Disclaimer: I'm not familiar with the interpreter internals, nor am I really a 
C dev, so I could be misinterpreting these results due to inexperience.

I've been attempting to debug a memory leak which I thought was caused by a C 
API extension that we are using.  When running the unit tests for this library 
under valgrind, I get a couple of results like the following, where the bottom 
of the call stack is a realloc() triggered by _PyUnicodeWriter_Finish()

==5732== 76 bytes in 1 blocks are definitely lost in loss record 4,571 of 9,822
==5732==at 0x4C2C291: realloc (vg_replace_malloc.c:836)
==5732==by 0x4F52323: _PyUnicodeWriter_Finish (in 
/usr/lib64/libpython3.6m.so.1.0)
==5732==by 0x4F5A087: PyUnicode_FromFormatV (in 
/usr/lib64/libpython3.6m.so.1.0)
==5732==by 0x4F937BC: PyErr_FormatV (in /usr/lib64/libpython3.6m.so.1.0)
==5732==by 0x4F93433: PyErr_Format (in /usr/lib64/libpython3.6m.so.1.0)
==5732==by 0x4F836B9: _PyEval_EvalFrameDefault (in 
/usr/lib64/libpython3.6m.so.1.0)
==5732==by 0x4F87C9E: PyEval_EvalCodeEx (in /usr/lib64/libpython3.6m.so.1.0)
==5732==by 0x4EF6DE2: ??? (in /usr/lib64/libpython3.6m.so.1.0)
==5732==by 0x4EDEF62: PyObject_Call (in /usr/lib64/libpython3.6m.so.1.0)
==5732==by 0xF9785EF: c_warningcb (in 
/usr/local/lib/pulp/lib/python3.6/site-packages/createrepo_c/_createrepo_c.so)
==5732==by 0xF98F897: cr_xml_parser_warning (in 
/usr/local/lib/pulp/lib/python3.6/site-packages/createrepo_c/_createrepo_c.so)
==5732==by 0xF98B59E: cr_start_handler (in 
/usr/local/lib/pulp/lib/python3.6/site-packages/createrepo_c/_createrepo_c.so)

There is no explicit call to realloc() in that function, but there is a call to 
resize_compact(), which in turn calls PyObject_Realloc(). I assume all those 
are getting inlined which is why it looks like there's nothing in-beteween -- 
if not, then maybe the leak is actually somewhere else.

The following is speculation given that I have limited understanding of 
interpreter workings.

In the version of Python I am using (3.6), resize_compact() has some code that 
looks suspicious to me: [0]

Two things jump out: 

1) "_Py_ForgetReference(unicode)", which according to this mailing list email 
[1] is used "to avoid having the deallocator run as result of the
DECREF".  The definition and usage of "_Py_ForgetReference(unicode)" in newer 
versions of Python is hidden behind "#ifdef Py_TRACE_REFS" flags [2], but it 
was not being done previously, which raises the question if perhaps it was 
being used improperly in previous versions. Forgetting about an object without 
deallocating it would certainly cause a leak.

2) When comparing [0] to a nearly identical piece of code meant for resizing 
bytestrings [3], I notice that in the branch handling the out of memory case, 
the bytestring version calls "PyObject_Del()" whereas the unicode version calls 
"_Py_NewReference()".

Can someone with more knowledge take a look at this?  And if neither of these 
are "the problem" then perhaps help me investigate what might be causing this 
Valgrind output?


[0] https://github.com/python/cpython/blob/3.6/Objects/unicodeobject.c#L943-L952

[1] https://www.mail-archive.com/python-dev@python.org/msg108525.html

[2] 
https://github.com/python/cpython/pull/18332/files#diff-34c966e7876d6f8bf801dd51896327e4f68bba02cddb95fbf3963f0b2e39c38aR1043-R1045

[3] https://github.com/python/cpython/blob/3.6/Objects/bytesobject.c#L3006-L3015

--
components: Interpreter Core
messages: 380077
nosy: dralley
priority: normal
severity: normal
status: open
title: Potential memory leak in resize_compact() (for unicode objects)
type: resource usage
versions: Python 3.6

___
Python tracker 

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



[issue42220] Argparse: wildcards processing

2020-10-31 Thread Andrew


New submission from Andrew :

It's known that Linux and Windows shells process wildcards like '*' and '?' 
differently. Linux shell usually expands wildcards so the application gets list 
of files. In contrast, Windows passes the wildcards to application. So in 
cross-platform applications we have to expand wildcards manually only for 
windows. It may not be beautiful since it's usually not part of program's logic 
and seems kinda of arguments processing.
Could this problem be solved via adding optional functionality to argparse 
library? For instance some option 'expand_wildcards' in ArgumentParser 
constructor with default value False (in order to not break compatibility)?

--
components: Library (Lib)
messages: 380076
nosy: Andrew
priority: normal
severity: normal
status: open
title: Argparse: wildcards processing
type: enhancement
versions: Python 3.10, Python 3.6, 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



[issue42198] Clean up docs for Union and GenericAlias

2020-10-31 Thread Ken Jin


Ken Jin  added the comment:

Guido, I have one last one -- "2. Park GenericAlias and Union under a new 
section 'Type Annotation Types' in stdtypes for 3.10". After which I'll close 
this issue. 

Thanks for reviewing my PRs so quickly!

--

___
Python tracker 

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



[issue33300] Bad usage example in id() DocString

2020-10-31 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue42198] Clean up docs for Union and GenericAlias

2020-10-31 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks for all your efforts, KJ! Can this issue be closed?

--

___
Python tracker 

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



[issue42198] Clean up docs for Union and GenericAlias

2020-10-31 Thread miss-islington


miss-islington  added the comment:


New changeset d21cb2d5ee56b8975d92e2ee094aba81f0801be5 by kj in branch 'master':
bpo-42198: Improve consistency of Union docs (GH-23029)
https://github.com/python/cpython/commit/d21cb2d5ee56b8975d92e2ee094aba81f0801be5


--

___
Python tracker 

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



[issue42198] Clean up docs for Union and GenericAlias

2020-10-31 Thread miss-islington


miss-islington  added the comment:


New changeset dbaa07db671c4e5842629c8be912f2b0370be794 by kj in branch '3.9':
[3.9] bpo-42198: Document __new__ for types.GenericAlias (GH-23039) (GH-23061)
https://github.com/python/cpython/commit/dbaa07db671c4e5842629c8be912f2b0370be794


--

___
Python tracker 

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



[issue42219] Typo in comment of listobject.h

2020-10-31 Thread Akshay.Gupta


Akshay.Gupta  added the comment:

My bad was not on the latest master. 
Fix already merged in 22588

--
resolution:  -> duplicate
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



[issue37483] Add PyObject_CallOneArg()

2020-10-31 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10
nosy_count: 4.0 -> 5.0
pull_requests: +21981
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/23062

___
Python tracker 

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



[issue42219] Typo in comment of listobject.h

2020-10-31 Thread Akshay.Gupta


New submission from Akshay.Gupta :

There is a typo in comment of _PyList_Cast(op) macro.
It should say 'PyListObject*' instead of 'PyTupleObject*'.

--
assignee: docs@python
components: Documentation
messages: 380070
nosy: akshayj398p, docs@python
priority: normal
severity: normal
status: open
title: Typo in comment of listobject.h
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue42160] unnecessary overhead in tempfile

2020-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I have tested my idea, such optimization speeds up _RandomNameSequence by 16%. 
At the cost of more complex code. It is not worth.

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

___
Python tracker 

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



[issue41552] uuid.uuid1() on certain Macs does not generate unique IDs

2020-10-31 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

An option is to use the host UUID instead of libuuid (as used by the _uuid 
extension). This has two problems though: (1) the RFC prescribes that the node 
id is a IEEE 802 MAC address, and (2) the host UUID is a full UUID and would 
have to be post processed.   Because of this I don't think this is a usable 
alternative.

The relevant API is gethostuuid().

Related stackoverflow: 
https://stackoverflow.com/questions/933460/unique-hardware-id-in-mac-os-x

Related elastic issue (where I found gethostuuid): 
https://github.com/elastic/beats/issues/14439

--

___
Python tracker 

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



[issue42160] unnecessary overhead in tempfile

2020-10-31 Thread Eric Wolf


Eric Wolf  added the comment:

>>> timeit(os.getpid)
0.0899073329931

Considering the reference leaks, os.getpid() seems to be the better solution.

--

___
Python tracker 

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



[issue41835] Speed up dict vectorcall creation using keywords

2020-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Do not overestimate the importance of _PyStack_AsDict(). Most of calls (~90-95% 
or like) are with positional only arguments, and most of functions do not have 
var-keyword parameter. So efforts in last years were spent on optimizing common 
cases, in particularly avoiding creation of a dict without need. 
_PyStack_AsDict() can affect perhaps 1% of code, or less, and these functions 
are usually not performance critical.

--

___
Python tracker 

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



[issue41552] uuid.uuid1() on certain Macs does not generate unique IDs

2020-10-31 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I've verified that python 3.8 and 3.9 use the system uuid functions (part of 
libsystem). This means this issue might not be fixable without dropping the use 
of the _uuid extension.

@terrygreeniaus: Can you still reproduce this issue?  If so, does "import 
_uuid" work on your system?


I do have a system with an iBridge interface, but that interface is below the 
active network interface and is never used.   That system is headless, I cannot 
easily try to reproduce the issue by messing with its network interfaces.

I wonder how useful it is to try to fix this issue, I'd personally prefer to 
use uuid4() because that doesn't leak information about the host.

--

___
Python tracker 

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



[issue42160] unnecessary overhead in tempfile

2020-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Instead of os.getpid() we can use a global variable, and the single callback 
can reset it.

But is it worth? Is os.getpid() so slow?

--

___
Python tracker 

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



[issue42218] SystemError in compile builtin function

2020-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Nice catch Zac!

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42160] unnecessary overhead in tempfile

2020-10-31 Thread Eric Wolf


Eric Wolf  added the comment:

It would be possible to allow the GC to finalize the Random instances through 
weak references.
On the other hand, if many _RandomNameSequence instances were used temporarily, 
a lot of callbacks would be registered via os.register_at_fork(), could that 
cause problems?

--

___
Python tracker 

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



[issue42217] compiler: merge co_code and co_lnotab

2020-10-31 Thread Inada Naoki


Inada Naoki  added the comment:

@Serhiy 

> Do you mean sharing values of co_code and co_lnotab between code objects of 
> the same module?

Yes.

> How much memory does this save (in absolute and relative value)?

Maybe 1~3%, but I am not sure. I am more interested in reducing number of 
objects, because it will reduce import time.
Additionally, co_code is used while executing code. Unlike other cold data 
(e.g. docstring, annotations), sharing co_code will improve CPU cache 
utilization.

> Which functions have the same co_code?

For example,

```
# logging/__init__.py

@property
def manager(self):
return self.logger.manager
...
@property
def name(self):
return self.logger.name
```

Such simple functions are very common in OO-style code.

@Mark Shannon

Sure.

--

___
Python tracker 

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



[issue42198] Clean up docs for Union and GenericAlias

2020-10-31 Thread Ken Jin


Change by Ken Jin :


--
pull_requests: +21980
pull_request: https://github.com/python/cpython/pull/23061

___
Python tracker 

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



[issue41835] Speed up dict vectorcall creation using keywords

2020-10-31 Thread Inada Naoki


Inada Naoki  added the comment:

> Both changes add significant amount of code (100 and 85 lines 
> correspondingly). Even if they speed up a particular case of dict constructor 
> it is not common use case.

You are right, but please wait.

Marco is new contributor and he can write correct C code for now.
So I am searching some parts which can be optimized by his code before 
rejecting it.

* bpo-42126, GH-22911: I can make dict display (aka. dict literal) 50% faster. 
But it introduce additional complexity to compiler and ceval. So I will reject 
it unless I find real world code using dict display in performance critical 
part.

* _PyStack_AsDict (https://github.com/methane/cpython/pull/25): I thought this 
is performance critical function. But I could not see significant performance 
gain in pyperformance.

* _PyEval_EvalCode 
(https://github.com/python/cpython/blob/master/Python/ceval.c#L4465): I am 
still not sure we can assume there are no duplicated keyword argument here. If 
we can assume it, we can optimize calling function receiving **kwds argument.

These three parts are all I found. I will reject this issue after I failed to 
optimize _PyEval_EvalCode.

--

___
Python tracker 

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



[issue42195] Inconsistent __args__ between typing.Callable and collections.abc.Callable

2020-10-31 Thread Ken Jin


Ken Jin  added the comment:

Hi, I submitted a PR for a proof-of-concept on how the code which subclasses 
GenericAlias might look like for everyone's consideration.  

Personally, I'd lean more towards what Serhiy said and change typing.Callable 
rather than GenericAlias which affects many other classes' __class_getitem__. 
However, considering that typing.Callable has been around for years, I'm 
hesitant to change its __args__ which might break programs which rely on it.

--

___
Python tracker 

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



[issue42195] Inconsistent __args__ between typing.Callable and collections.abc.Callable

2020-10-31 Thread Ken Jin


Change by Ken Jin :


--
keywords: +patch
nosy: +kj
nosy_count: 6.0 -> 7.0
pull_requests: +21979
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23060

___
Python tracker 

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



[issue32937] Multiprocessing worker functions not terminating with a large number of processes and a manager

2020-10-31 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

This issue can probably be closed as out of date:

Using: Python3.9, installer from python.org. On my laptop os.cpu_count() == 8.

"python -c 'import repro; repro.main()' works for me (it runs a while and 
exists when all workers have exited). The repro module contains the code below, 
this is the code from the original message with some changes because of changes 
to the multiprocessing launcher strategy on macOS.

# repro.py
import multiprocessing
from multiprocessing import Pool, Manager
import time
import random

def worker_function( index, messages ):

print( "%d: Entered" % index )
time.sleep( random.randint( 3, 15 ) )
messages.put( "From: %d" % index )
print( "%d: Exited" % index )


def main():
manager = Manager()
messages = manager.Queue()
with Pool( processes = None ) as pool:

for x in range( 30 ):
pool.apply_async( worker_function, [ x, messages ] )

pool.close()
pool.join()
# EOF

--
nosy: +ronaldoussoren
resolution:  -> out of date
stage:  -> resolved
status: open -> pending
type:  -> behavior

___
Python tracker 

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



[issue16902] Add OSS module support for Solaris

2020-10-31 Thread Sebastian Wiedenroth


Sebastian Wiedenroth  added the comment:

This patch has also been applied to the python versions shipped by OpenIndiana 
and OmniOS for a long time. I'd say it's safe to merge.

--
nosy: +wiedi

___
Python tracker 

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



[issue29566] binhex() creates files with mixed line endings

2020-10-31 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I've added a PR that changes the line ending to "\r" in encoded data.

Not very useful now that binhex is deprecated, but this allows us to close this 
issue.

--
versions: +Python 3.10, Python 3.8, Python 3.9 -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



[issue29566] binhex() creates files with mixed line endings

2020-10-31 Thread Ronald Oussoren


Change by Ronald Oussoren :


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

___
Python tracker 

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



[issue42210] float.hex discards sign from -nan

2020-10-31 Thread Mark Dickinson


Mark Dickinson  added the comment:

This isn't a bug: it was a deliberate decision, just like the choice to 
represent `-nan` as `nan` in `float.__repr__` was a deliberate decision. NaNs 
don't have a meaningful sign - they have a sign *bit*, but it's best to regard 
that as just an extra bit of metadata (like the payload bits).

IEEE 754 explicitly refuses to interpret the sign bit of a NaN: section 1.4 of 
the 2019 version of the standard says: "This standard does not specify [...] 
Interpretation of the sign and significand fields of NaNs."

As Vedran points out, infinities are a very different beast: the difference 
between negative infinity and positive infinity matters.

[Raymond]

> no application should rely on seeing a particular sign for a NaN

Yep, exactly.

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



[issue26377] Tkinter dialogs will not close if root window not packed.

2020-10-31 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Is this problem still present?

I've used the following script to test:

import tkinter
from tkinter import messagebox

root = tkinter.Tk()
box = messagebox.showinfo("Title", "A Message")

# -- EOF ---

With this script I can close the message box without problems (by clicking on 
the OK button). Both when running from the command-line and when running from 
IDLE.

Python 3.9, installer from python.org.

--

___
Python tracker 

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



[issue42218] SystemError in compile builtin function

2020-10-31 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


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

___
Python tracker 

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



[issue42218] SystemError in compile builtin function

2020-10-31 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

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



[issue42218] SystemError in compile builtin function

2020-10-31 Thread Zac Hatfield-Dodds


New submission from Zac Hatfield-Dodds :

In Python 3.9.0, running

compile('A.\u018a\\ ', '', 'single')

raises

SystemError:  returned a result with an error 
set

This is obviously invalid syntax, but it would still be nice to raise 
SyntaxError for that and the SystemError may be symptomatic of a bug.  
Unfortunately I have no insight to offer beyond this hand-minimised reproducer 
:-/

--
components: Interpreter Core
messages: 380053
nosy: Zac Hatfield-Dodds
priority: normal
severity: normal
status: open
title: SystemError in compile builtin function
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



[issue42160] unnecessary overhead in tempfile

2020-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also issue30030.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41835] Speed up dict vectorcall creation using keywords

2020-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Both changes add significant amount of code (100 and 85 lines correspondingly). 
Even if they speed up a particular case of dict constructor it is not common 
use case.

I think that it would be better to reject these changes. They make maintenance 
harder, the benefit seems insignificant, and there is always a danger that new 
code can slow down other code. The dict object is performance critical for 
python, so it is better to not touch its code without need.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42217] compiler: merge co_code and co_lnotab

2020-10-31 Thread Mark Shannon


Mark Shannon  added the comment:

PEP 626 has just been accepted.
Could you please leave this until I have merged in the implementation of PEP 
626 which uses a different line number table format

--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue42217] compiler: merge co_code and co_lnotab

2020-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Do you mean sharing values of co_code and co_lnotab between code objects of the 
same module?

How much memory does this save (in absolute and relative value)? Which 
functions have the same co_code?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42195] Inconsistent __args__ between typing.Callable and collections.abc.Callable

2020-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Would not be better to change typing.Callable?

Attributes __origin__, __args__ and __parameters__ are not documented in the 
typing module. They are also not mentioned in any PEP except PEP 585. So I 
don't know what is intention and correct value of these attributes.

--

___
Python tracker 

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



[issue40956] Use Argument Clinic in sqlite3

2020-10-31 Thread Erlend Egeberg Aasland

Erlend Egeberg Aasland  added the comment:

> Thank you erlendaasland for working on GH-22484.

… and thank you for taking the time to review this!

--

___
Python tracker 

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



[issue40956] Use Argument Clinic in sqlite3

2020-10-31 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +21976
pull_request: https://github.com/python/cpython/pull/23057

___
Python tracker 

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



  1   2   >