[issue42550] re库匹配问题

2020-12-02 Thread ye andy


Change by ye andy :


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



[issue42550] re库匹配问题

2020-12-02 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

https://docs.python.org/3/howto/regex.html#more-metacharacters

$
Matches at the end of a line, which is defined as either the end of the string, 
or any location followed by a newline character.

\Z
Matches only at the end of the string.

>>> eth_re = re.compile(r'^0x[0-9a-fA-F]{40}\Z')
>>> print(eth_re.match(a))
None
>>> eth_re = re.compile(r'^0x[0-9a-fA-F]{40}$')
>>> print(eth_re.match(a))


You can also use re.DEBUG to see the difference


>>> re.match(r'^0x[0-9a-fA-F]{40}$', a, re.DEBUG)
AT AT_BEGINNING
LITERAL 48
LITERAL 120
MAX_REPEAT 40 40
  IN
RANGE (48, 57)
RANGE (97, 102)
RANGE (65, 70)
AT AT_END

 0. INFO 4 0b0 42 42 (to 5)
 5: AT BEGINNING
 7. LITERAL 0x30 ('0')
 9. LITERAL 0x78 ('x')
11. REPEAT_ONE 16 40 40 (to 28)
15.   IN 11 (to 27)
17. CHARSET [0x, 0x03ff, 0x007e, 0x007e, 0x, 
0x, 0x, 0x]
26. FAILURE
27:   SUCCESS
28: AT END
30. SUCCESS



>>> re.match(r'^0x[0-9a-fA-F]{40}\Z', a, re.DEBUG)
AT AT_BEGINNING
LITERAL 48
LITERAL 120
MAX_REPEAT 40 40
  IN
RANGE (48, 57)
RANGE (97, 102)
RANGE (65, 70)
AT AT_END_STRING

 0. INFO 4 0b0 42 42 (to 5)
 5: AT BEGINNING
 7. LITERAL 0x30 ('0')
 9. LITERAL 0x78 ('x')
11. REPEAT_ONE 16 40 40 (to 28)
15.   IN 11 (to 27)
17. CHARSET [0x, 0x03ff, 0x007e, 0x007e, 0x, 
0x, 0x, 0x]
26. FAILURE
27:   SUCCESS
28: AT END_STRING
30. SUCCESS

--
nosy: +xtreak

___
Python tracker 

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



[issue42550] re库匹配问题

2020-12-02 Thread ye andy


ye andy  added the comment:

Okay, I just thought it was weird

--

___
Python tracker 

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



[issue42550] re库匹配问题

2020-12-02 Thread hongweipeng


hongweipeng  added the comment:

Maybe you need use `eth_re.match(a, re.MULTILINE)` or `eth_re.fullmatch(a)` .

--
nosy: +hongweipeng

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2020-12-02 Thread Jack O'Connor


Jack O'Connor  added the comment:

This change caused a crash in the Duct library in Python 3.9. Duct uses the 
waitid(NOWAIT) strategy that Nathaniel Smith has described in this thread. With 
this change, the child process is reaped by kill() in a spot we didn't expect, 
and a subsequent call to os.waitid() raises a ChildProcessError. This is a race 
condition that only triggers if the child happens to exit before kill() is 
called.

I just pushed 
https://github.com/oconnor663/duct.py/commit/5dfae70cc9481051c5e53da0c48d9efa8ff71507
 to work around this, which I'll release shortly as Duct version 0.6.4.

Broadly speaking, this change could break any program that uses Popen.kill() 
together with os.waitpid() or os.waitid(). Checking Popen.returncode before 
calling the os functions is a good workaround for the single-threaded case, but 
it doesn't fix the multithreaded case. Duct is going to avoid calling 
Popen.kill() entirely. There are some longer comments about race conditions in 
that commit I linked.

I don't feel strongly one way the other about keeping this new behavior, but we 
should probably document it clearly in Popen.send_signal() and all of its 
callers that these functions might reap the child.

--
nosy: +oconnor663

___
Python tracker 

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



[issue42550] re库匹配问题

2020-12-02 Thread ye andy


ye andy  added the comment:

My regulus requires the beginning of 0x, the end of 0-9A-fa-f, my ending \n, he 
also shows success, my expected result is failure, I wrote the problem?

--

___
Python tracker 

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



[issue42550] re库匹配问题

2020-12-02 Thread ye andy


ye andy  added the comment:

My regex requires ending with 0-9a-fa-f, and I now end with a line break, which 
in theory should not work. Why did it work?

--
nosy:  -Dennis Sweeney

___
Python tracker 

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



[issue42550] re库匹配问题

2020-12-02 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Maybe you're looking for re.fullmatch:

https://docs.python.org/3/library/re.html#re.fullmatch

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue42550] re库匹配问题

2020-12-02 Thread ye andy


ye andy  added the comment:

What I mean by that is that the regex That I wrote should match successfully is 
a 42-bit string, but it is also successful when we add more newlines

--

___
Python tracker 

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



[issue42550] re库匹配问题

2020-12-02 Thread Ma Lin


Ma Lin  added the comment:

This issue can be closed.

'0x'  2
'd26935a5ee4cd542e8a3a7e74fb7a99855975b59'  40
'\n'  1

2+40+1 = 43

--
nosy: +malin

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread Brandt Bucher


Brandt Bucher  added the comment:

Also, it appears enumerate is affected as well.

--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread Brandt Bucher


Brandt Bucher  added the comment:

(By the way, I didn't know that -F runs the tests forever... so I was waiting 
*almost* forever for it to finish!)

--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread Brandt Bucher


Brandt Bucher  added the comment:

It looks like Victor's original issue is unrelated to zip, though. That test 
run is clean after adding the same fix to:

- itertools.product
- itertools.combinations
- itertools.combinations_with_replacement
- itertools.permutations
- itertools.zip_longest

...all of which use the same tuple-recycling speed trick.

If my zip PR looks good, I can create another one fixing these as well.

--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread Brandt Bucher


Change by Brandt Bucher :


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

___
Python tracker 

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



[issue42551] Generator `yield`s counted as primitive calls by cProfile

2020-12-02 Thread Matthew Suozzo


New submission from Matthew Suozzo :

# Issue

When profiling a generator function, the initial call and all subsequent yields 
are aggregated into the same "ncalls" metric by cProfile.

## Example

>>> cProfile.run("""
... def foo():
...   yield 1
...   yield 2
... assert tuple(foo()) == (1, 2)
... """)
   
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
  ...
30.0000.0000.0000.000 :2(foo)
  ...

This was unexpected behavior since it *looks* like a single call from the code. 
This also complicates basic analysis about the frequency of a codepath's 
execution where a generator might yield a variable number of times depending on 
the input.

The profile interface can and does differentiate between call types: Normal 
calls and "primitive" calls, i.e. those that are not induced via recursion, are 
displayed as "all_calls/primitive_calls" e.g. "3/1" for a single initial calls 
with 2 recursed calls (comparable to the example above).

This seems like an appropriate abstraction to apply in the generator case: Each 
yield is better modeled as an 'interior' call to the generator, not as a call 
on its own.

# Possible fix

I have two ideas that seem like they might address the problem:

* Add a new PyTrace_YIELD constant (and handle it in [3])
* Track some state from the `frame->f_gen` in the ProfilerEntry (injected in 
[3], used in [4]) to determine whether this is the first or a subsequent call.

I've not been poking around for long so I don't have an intuition about which 
would be less invasive (nor really whether either would work in practice).

As background, this seems to be the call chain from trace invocation to 
callcount increment:
[0]: 
https://github.com/python/cpython/blob/4e7a69bdb63a104587759d7784124492dcdd496e/Python/ceval.c#L4106-L4107
[1]: 
https://github.com/python/cpython/blob/4e7a69bdb63a104587759d7784124492dcdd496e/Python/ceval.c#L4937
[2]: 
https://github.com/python/cpython/blob/4e7a69bdb63a104587759d7784124492dcdd496e/Python/ceval.c#L4961
[3]: 
https://github.com/python/cpython/blob/4e7a69bdb63a104587759d7784124492dcdd496e/Modules/_lsprof.c#L419
[4]: 
https://github.com/python/cpython/blob/4e7a69bdb63a104587759d7784124492dcdd496e/Modules/_lsprof.c#L389
[5]: 
https://github.com/python/cpython/blob/4e7a69bdb63a104587759d7784124492dcdd496e/Modules/_lsprof.c#L311-L316

--
components: C API
messages: 382373
nosy: matthew.suozzo
priority: normal
severity: normal
status: open
title: Generator `yield`s counted as primitive calls by cProfile
type: behavior
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



[issue42504] Failure to build with MACOSX_DEPLOYMENT_TARGET=11 on Big Sur

2020-12-02 Thread miss-islington


miss-islington  added the comment:


New changeset 09a698b4743c669983d606595a1b2daeff6c3cf8 by Miss Islington (bot) 
in branch '3.9':
bpo-42504: fix for MACOSX_DEPLOYMENT_TARGET=11 (GH-23556)
https://github.com/python/cpython/commit/09a698b4743c669983d606595a1b2daeff6c3cf8


--

___
Python tracker 

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



[issue42504] Failure to build with MACOSX_DEPLOYMENT_TARGET=11 on Big Sur

2020-12-02 Thread Ned Deily


Change by Ned Deily :


--
versions: +Python 3.10, Python 3.8

___
Python tracker 

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



[issue42504] Failure to build with MACOSX_DEPLOYMENT_TARGET=11 on Big Sur

2020-12-02 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +22490
pull_request: https://github.com/python/cpython/pull/23622

___
Python tracker 

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



[issue42504] Failure to build with MACOSX_DEPLOYMENT_TARGET=11 on Big Sur

2020-12-02 Thread Ned Deily


Ned Deily  added the comment:


New changeset 5291639e611dc3f55a34666036f2c3424648ba50 by FX Coudert in branch 
'master':
bpo-42504: fix for MACOSX_DEPLOYMENT_TARGET=11 (GH-23556)
https://github.com/python/cpython/commit/5291639e611dc3f55a34666036f2c3424648ba50


--

___
Python tracker 

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



[issue31990] Pickling deadlocks in thread with python -m

2020-12-02 Thread Sara Kelley


Sara Kelley  added the comment:

After looking a little more I don't believe the extension is the problem, but 
it is an easier way to see the problem. When testqueuepickle3 is run as a 
script you don't see the error. When it is imported as a module, even from 
another script with valid syntax, it does deadlock.

--

___
Python tracker 

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



[issue42547] argparse: add_argument(... nargs='+', metavar=) does not work with positional arguments

2020-12-02 Thread paul j3


paul j3  added the comment:

I'll reopen it - your patch, while not a complete resolution, does take care of 
the immediate error.

--
resolution: duplicate -> 
status: closed -> open

___
Python tracker 

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



[issue42547] argparse: add_argument(... nargs='+', metavar=) does not work with positional arguments

2020-12-02 Thread paul j3


paul j3  added the comment:

Duplicate of

https://bugs.python.org/issue14074

argparse allows nargs>1 for positional arguments but doesn't allow metavar to 
be a tuple

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



[issue42547] argparse: add_argument(... nargs='+', metavar=) does not work with positional arguments

2020-12-02 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +paul.j3, rhettinger

___
Python tracker 

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



[issue42550] re库匹配问题

2020-12-02 Thread ye andy

New submission from ye andy :

import re
a = """0xd26935a5ee4cd542e8a3a7e74fb7a99855975b59\n"""

eth_re = re.compile(r'^0x[0-9a-fA-F]{40}$')

print(eth_re.match(a))
print(len(a)) # 长度43

--
components: Library (Lib)
messages: 382367
nosy: andy.ye.jx
priority: normal
severity: normal
status: open
title: re库匹配问题
type: security
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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread Kevin Walzer


Kevin Walzer  added the comment:

Ned, I wish I knew. Marc and I are both now members of the TCT, and have had a 
few conversations around the release schedule, but the release schedule is more 
or less determined when one or two senior members of the TCT decide things are 
ready. We had some momentum toward an RC of 8.6.11 a few months ago, but that 
seems to have stalled out.

--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread Brandt Bucher


Brandt Bucher  added the comment:

Some quick benchmarks on a normal build with CPU isolation, tuned with pyperf. 
No PGO/LTO.

$ ./python -m pyperf timeit --rigorous --setup 'i = (None,) * 10_000_000' 'for 
_, _ in zip(i, i): pass'  # Current master.
.
Mean +- std dev: 279 ms +- 11 ms

$ ./python -m pyperf timeit --rigorous --setup 'i = (None,) * 10_000_000' 'for 
_, _ in zip(i, i): pass'  # With above fix.
.
Mean +- std dev: 369 ms +- 20 ms

$ ./python -m pyperf timeit --rigorous --setup 'i = (None,) * 10_000_000' 'for 
_, _ in zip(i, i): pass'  # With above fix (no _PyTuple_MaybeUntrack).
.
Mean +- std dev: 284 ms +- 17 ms

$ ./python -m pyperf timeit --rigorous --setup 'i = (None,) * 10_000_000' 'for 
_, _ in zip(i, i): pass'  # With no tuple reuse.
.
Mean +- std dev: 526 ms +- 51 ms

Note that this example reuses the result tuple for *every* iteration.

--

___
Python tracker 

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



[issue42507] test_ttk_guionly test failures on macOS with Tcl/Tk 8.6.10

2020-12-02 Thread Ned Deily


Ned Deily  added the comment:

Terry:
> It might be the tk/tkinter build, not the tests, that is at fault.

Can you elaborate?

--

___
Python tracker 

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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread Ned Deily


Ned Deily  added the comment:

Thanks for checking, Kevin. Is there any update on when we can expect a Tk 
8.6.11?  It's been over a year now since 8.6.10 and there have been so many 
macOS-related changes that have gone into Tk since then. It's really not fair 
to ask downstream packagers, like us for the python.org installers, or end 
users to build with an arbitrary checkpoint of the development branch. Even a 
beta 8.6.11 would be an improvement.

--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread Brandt Bucher


Brandt Bucher  added the comment:

Simple demo:

>>> import gc
>>> gc.disable()
>>> z = zip([[]])
>>> gc.is_tracked(next(z))
True
>>> z = zip([[]])
>>> gc.collect()
0
>>> gc.is_tracked(next(z))
False

--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread Brandt Bucher


Brandt Bucher  added the comment:

It looks like the GC untracks the None-filled result tuple in untrack_tuples, 
and it's never re-tracked again. This can also happen if it's filled with 
atomic values on an early iteration and the GC visits it.

Perhaps a simple fix is to call _PyObject_GC_TRACK on the result tuple inside 
of each zip_next call if it's not tracked anymore?

if (!_PyObject_GC_IS_TRACKED(result)) {
_PyObject_GC_TRACK(result);
}
_PyTuple_MaybeUntrack(result);  // Worth it?
return result;

Although I'm not sure how much of a win we're getting from the result tuple 
reuse here - maybe it's easier to just not do that.

--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> 

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Adding Brandt because he recently worked on the zip() code.

--
nosy: +brandtbucher

___
Python tracker 

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



[issue31990] Pickling deadlocks in thread with python -m

2020-12-02 Thread Sara Kelley


Sara Kelley  added the comment:

https://docs.python.org/3/using/cmdline.html#cmdoption-m

The documentation says you must not give a file extension with the module 
option. Because the extension was given the thread is deadlocking in 
importlib._bootstrap when trying to acquire the module lock. The hang occurs in 
the script because join() is waiting for the deadlocked thread.

--

___
Python tracker 

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



[issue38520] There is no proper way to know if a process is the main one

2020-12-02 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 4.0 -> 5.0
pull_requests: +22489
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23621

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread STINNER Victor


STINNER Victor  added the comment:

> The GC is supposed to be able to break such cycle, no?

In zip_new(), lz->result tuple is *not* always tracked by the GC.

--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread STINNER Victor


STINNER Victor  added the comment:

Raymond Hettinger:
> If this is new, pairwise() is the most likely cause.

I reproduced the issue without involving the itertools module. It seems to be a 
zip_next() micro-optimization which keeps an object alive longer than epxected. 
This micro-optimization is not new. It's just really hard to trigger the issue.

It seems to depend if the zip object is deleted or not. The builtin zip type 
implements a traverse function which visits Py_VISIT(lz->result). The GC is 
supposed to be able to break such cycle, no?

--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-02 Thread STINNER Victor


Change by STINNER Victor :


--
title: test_itertools leaks sometimes references -> Iterating on a zip keeps 
objects alive longer than expected (test_itertools leaks sometimes references)

___
Python tracker 

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



[issue42536] test_itertools leaks sometimes references

2020-12-02 Thread STINNER Victor


STINNER Victor  added the comment:

I reproduce the leak with attached test_zip.py by running:

$ ./python -m test -R 3:3 test_zip_leak -j4 -m 
test.test_zip_leak.TestGC.test_permutations -m 
test.test_zip_leak.TestGC.test_zip

The problem is that the builtin zip class keeps an internal tuple alive. See 
zip_next) and zipobject.result member (tuple).

--
Added file: https://bugs.python.org/file49650/test_zip_leak.py

___
Python tracker 

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



[issue42324] Doctest: directives

2020-12-02 Thread Julien Palard


Julien Palard  added the comment:

Thanks for reporting!

This will be fixed soon: https://github.com/python/cpython/pull/23620

I'm marking issue42324 as duplicate of issue36675.

--
nosy: +mdk
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Doctest directives and comments missing from code samples

___
Python tracker 

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



[issue42549] "quopri" line endings not standard conform

2020-12-02 Thread Dieter Maurer


New submission from Dieter Maurer :

RFC 1521 and "https://tools.ietf.org/html/rfc2045#section-6.7";
stipulate that the quoted printable encoding uses CRLF line endings. Python's 
"quopri" implementation does not honor this.

--
components: Library (Lib)
messages: 382354
nosy: dmaurer
priority: normal
severity: normal
status: open
title: "quopri" line endings not standard conform
type: behavior

___
Python tracker 

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



[issue36675] Doctest directives and comments missing from code samples

2020-12-02 Thread Julien Palard


Change by Julien Palard :


--
pull_requests: +22488
pull_request: https://github.com/python/cpython/pull/23620

___
Python tracker 

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



[issue35342] email "default" policy raises exception iterating over unparseable date headers

2020-12-02 Thread Irit Katriel


Irit Katriel  added the comment:

I get this. Was the bug fixed?

>>> email.message_from_string('Date: not a parseable date', 
>>> policy=email.policy.default).items()
[('Date', 'not a parseable date')]

--
nosy: +iritkatriel
status: open -> pending

___
Python tracker 

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



[issue8535] passing optimization flags to the linker required for builds with gcc -flto

2020-12-02 Thread Irit Katriel


Change by Irit Katriel :


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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread Kevin Walzer


Kevin Walzer  added the comment:

This bug is not present in IDLE 3.9.0 when built against the tip of Tk 
core-8-6-branch. Marc Culler has done some work to fix the visual artifacts, 
and the work continues. The problem here is that Apple's API churn continually 
breaks parts of Tk with each new OS release, and there is large amount of work 
just to keep things working reasonably.

--
nosy: +wordtech

___
Python tracker 

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



[issue42548] debugger stops at breakpoint of `pass` that is not actually reached

2020-12-02 Thread Andy S


New submission from Andy S :

The python (3.6) doc states 
(https://docs.python.org/3/reference/simple_stmts.html#the-pass-statement):

pass is a null operation...

So since this is still an operation one could expect that it can be used as an 
op to breakpoint on while debugging some scripts.

Nevertheless:

$ pdb3.7 ./debug_bug.py 
> /...play/debug_bug.py(1)()
-> a = None
(Pdb) list
  1  -> a = None
  2  
  3  
  4 def fun():
  5 b = False
  6 if a is None:
  7 b = True
  8 pass
  9 else:
 10 pass
 11  
(Pdb) 
 12  
 13 fun()
 14 pass
[EOF]
(Pdb) b 10
Breakpoint 1 at /...play/debug_bug.py:10
(Pdb) run
Restarting ./debug_bug.py with arguments:
./debug_bug.py
> /...play/debug_bug.py(1)()
-> a = None
(Pdb) continue
> /...play/debug_bug.py(10)fun()
-> pass
(Pdb) bt
  /usr/lib/python3.7/bdb.py(585)run()
-> exec(cmd, globals, locals)
  (1)()
  /...play/debug_bug.py(13)()
-> fun()
> /...play/debug_bug.py(10)fun()
-> pass
(Pdb) p b
True
(Pdb)

--
components: Interpreter Core, Library (Lib)
files: debug_bug.py
messages: 382351
nosy: gatekeeper.mail
priority: normal
severity: normal
status: open
title: debugger stops at breakpoint of `pass` that is not actually reached
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file49649/debug_bug.py

___
Python tracker 

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



[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2020-12-02 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Thanks William for the detailed problem description.

If the issue has been fixed on Python 3.9 but not on 3.8, then it was likely a 
redesign that enabled the improved behavior, a redesign that won't be ported 
back to Python 3.8 and earlier. In these situations, the best recommendation is 
often to just rely on importlib_resources (the backport) for those older Python 
versions.

In this case, you've identified a fairly surgical fix that may be suitable to 
apply to these older affected Pythons, so I'll consider that, but before I do, 
have you considered using importlib_resources for Python 3.8 and earlier? That 
would likely also address the issue and you could adopt it sooner.

To some extent, the behavior you've described could be considered a bug or 
could be considered a feature request (add support for path on packages that 
have no __spec__.origin). I am not aware whether this limitation was by design 
or incidental.

--

___
Python tracker 

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



[issue23805] _hashlib compile error?

2020-12-02 Thread Irit Katriel


Irit Katriel  added the comment:

Freddy, this issue is 5 years old with no activity and no indicated action for 
the python devs, so I am closing it. If you are still seeing compilation 
errors, please create a new one and update it with more details.

--
nosy: +iritkatriel
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



[issue42521] Debug (-d) mode not working in 3.9

2020-12-02 Thread miss-islington


miss-islington  added the comment:


New changeset 9b34f34aa929941576a69a6f7de77f1fb0b96ed6 by Miss Islington (bot) 
in branch '3.9':
bpo-42521: Add note about 'Python -d' only working on debug builds (GH-23607)
https://github.com/python/cpython/commit/9b34f34aa929941576a69a6f7de77f1fb0b96ed6


--

___
Python tracker 

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



[issue42545] Check that all symbols in the limited ABI are exported

2020-12-02 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +vstinner

___
Python tracker 

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



[issue42546] copy - Allow dict.copy(deep=True) alongside copy.deepcopy() for easier usage and zen

2020-12-02 Thread Irit Katriel


Irit Katriel  added the comment:

Deprecating an API is a big project. To justify the time people would have to 
put into this, it needs to have significant benefits. I don't see them and the 
OP didn't explain what they are. 

Suggestions like this should ideally be brought up for discussion on the 
python-ideas mailing list before submitted here.

--
nosy: +iritkatriel
resolution:  -> rejected
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



[issue36964] `python3 -m venv NAME`: virtualenv is not portable

2020-12-02 Thread Marco Sulla


Marco Sulla  added the comment:

The PR will probably be rejected... you can do something like this:

1. in the venv on our machine, do `pip freeze`. This gives you the whole list 
of installed dependencies
2. download all the packages using `pip download`
3. copy all the packages on the cloud, create the venv and install them using 
`pip install $PATH_TO_PACKAGE`

--

___
Python tracker 

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



[issue38283] sys._getframe(1).f_lineno changed behavior in 3.8

2020-12-02 Thread Irit Katriel


Change by Irit Katriel :


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



[issue42546] copy - Allow dict.copy(deep=True) alongside copy.deepcopy() for easier usage and zen

2020-12-02 Thread Daniel Rose


Daniel Rose  added the comment:

My apologies. I worded that wrong, I meant adding `deep=True` to `dict.copy()`. 
Otherwise, you're absolutely right.

--

___
Python tracker 

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



[issue42546] copy - Allow dict.copy(deep=True) alongside copy.deepcopy() for easier usage and zen

2020-12-02 Thread Daniel Rose


Change by Daniel Rose :


--
title: copy - Allow .copy(deep=True) alongside .deepcopy() for easier usage and 
zen -> copy - Allow dict.copy(deep=True) alongside copy.deepcopy() for easier 
usage and zen

___
Python tracker 

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



[issue42536] test_itertools leaks sometimes references

2020-12-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks.  I'll work on it this evening.  If this is new, pairwise() is the most 
likely cause.

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue30701] Exception parsing certain invalid email address headers

2020-12-02 Thread Irit Katriel


Irit Katriel  added the comment:

I don't see the error now, I think this has been fixed.

--
nosy: +iritkatriel
status: open -> pending

___
Python tracker 

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



[issue42547] argparse: add_argument(... nargs='+', metavar=) does not work with positional arguments

2020-12-02 Thread Mikhail Khvoinitsky


Change by Mikhail Khvoinitsky :


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

___
Python tracker 

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



[issue42536] test_itertools leaks sometimes references

2020-12-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

You can get a list of all tests with --list-cases and then run them in separate 
processes.

--

___
Python tracker 

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



[issue42547] argparse: add_argument(... nargs='+', metavar=) does not work with positional arguments

2020-12-02 Thread Mikhail Khvoinitsky


New submission from Mikhail Khvoinitsky :

Example which works:

parser.add_argument('--test', nargs='+', metavar=('TEST', 'TEST2'))



Example which doesn't work:

parser.add_argument('test', nargs='+', metavar=('TEST', 'TEST2'))

it raises:

Traceback (most recent call last):
  File 
args = parser.parse_args()
  File "/usr/lib/python3.8/argparse.py", line 1768, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3.8/argparse.py", line 1800, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.8/argparse.py", line 2006, in _parse_known_args
start_index = consume_optional(start_index)
  File "/usr/lib/python3.8/argparse.py", line 1946, in consume_optional
take_action(action, args, option_string)
  File "/usr/lib/python3.8/argparse.py", line 1874, in take_action
action(self, namespace, argument_values, option_string)
  File "/usr/lib/python3.8/argparse.py", line 1044, in __call__
parser.print_help()
  File "/usr/lib/python3.8/argparse.py", line 2494, in print_help
self._print_message(self.format_help(), file)
  File "/usr/lib/python3.8/argparse.py", line 2471, in format_help
formatter.add_arguments(action_group._group_actions)
  File "/usr/lib/python3.8/argparse.py", line 276, in add_arguments
self.add_argument(action)
  File "/usr/lib/python3.8/argparse.py", line 261, in add_argument
invocations = [get_invocation(action)]
  File "/usr/lib/python3.8/argparse.py", line 549, in 
_format_action_invocation
metavar, = self._metavar_formatter(action, default)(1)
ValueError: too many values to unpack (expected 1)


Expected result: help message should look like this:

usage: test_argparse [-h] TEST [TEST2 ...]

positional arguments:
  TEST

optional arguments:
  -h, --help  show this help message and exit

--
components: Library (Lib)
messages: 382341
nosy: m_khvoinitsky
priority: normal
severity: normal
status: open
title: argparse: add_argument(... nargs='+', metavar=) does not work 
with positional arguments
type: crash
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



[issue42536] test_itertools leaks sometimes references

2020-12-02 Thread STINNER Victor


STINNER Victor  added the comment:

> nosy: + rhettinger, serhiy.storchaka

I wanted to bisect this test before annoying too many people with this random 
issue. So far, I managed to simplified test_itertools to:

def test_main(verbose=None):
test_classes = (
TestBasicOps,
TestVariousIteratorArgs,
TestGC,
)
support.run_unittest(*test_classes)

--

___
Python tracker 

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



[issue42546] copy - Allow .copy(deep=True) alongside .deepcopy() for easier usage and zen

2020-12-02 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This would be a classic example of the "Flag argument" anti-pattern:

https://www.martinfowler.com/bliki/FlagArgument.html

--
nosy: +steven.daprano

___
Python tracker 

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



[issue42546] copy - Allow .copy(deep=True) alongside .deepcopy() for easier usage and zen

2020-12-02 Thread Daniel Rose


New submission from Daniel Rose :

It would be convenient and cleaner/more in line with the Python zen to allow 
`.copy()` to allow a `deep=True` argument, to use `.deepcopy()` in a simpler 
way. This is easier to read, and brings some more usefulness to `.copy()`. 
`.deepcopy()` would be kept for backwards compatibility.

--
components: Library (Lib)
messages: 382338
nosy: TheCatster
priority: normal
severity: normal
status: open
title: copy - Allow .copy(deep=True) alongside .deepcopy() for easier usage and 
zen
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



[issue42545] Check that all symbols in the limited ABI are exported

2020-12-02 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue40939] Remove the old parser

2020-12-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Opened https://bugs.python.org/issue42545 for that

--

___
Python tracker 

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



[issue42545] Check that all symbols in the limited ABI are exported

2020-12-02 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

>From the discussion at the end of https://bugs.python.org/issue40939 is 
>important to add a check to the CI that can tell us if we mistakenly remove a 
>symbol of the limited ABI.

--
components: Tests
messages: 382336
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Check that all symbols in the limited ABI are exported
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



[issue42544] In windows, asyncio.run_in_executor strips logger class information from modified logging.Logger objects

2020-12-02 Thread Alex Sherman


New submission from Alex Sherman :

IN WINDOWS asyncio's loop.run_in_executor(pool, callback, logger, *args) strips 
the subclass information about logging.Loggers when passed into 
concurrent.futures.ProcessPoolExecutor. The logger behaves as a default 
logging.Logger object as far as I can tell.

Run the attached file to see via print statements that the logger information 
(such as additional verbosity and file handling) is all removed from the logger 
but only inside the loop.run_in_executor call. 

This is a windows specific error. Tested on windows 10 (misbehaved) and ubuntu 
18.04 (behaved as expected).

--
components: IO, asyncio
files: example_logger_behavior.py
messages: 382335
nosy: adsherman09, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: In windows, asyncio.run_in_executor strips logger class information from 
modified logging.Logger objects
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49648/example_logger_behavior.py

___
Python tracker 

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



[issue36964] `python3 -m venv NAME`: virtualenv is not portable

2020-12-02 Thread Cameron Hudson


Cameron Hudson  added the comment:

@MarcoSulla thank you for opening this issue, it is a very necessary 
improvement.

My use case: I install packages one machine inside VPN, which downloads from a 
private pypi repo. I then package this as a zip file and deploy it on a 
cloud-hosted VM. I cannot simply reinstall the dependencies on the VM, because 
it can't reach the private pypi repo.

I have not contributed to Python before, but I am happy to help with reviewing 
a PR with the changes that you suggested.

--
nosy: +CameronHudson8

___
Python tracker 

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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread E. Paine


E. Paine  added the comment:

It seems to be some weird internal mismatch. Code modified from 
https://wiki.tcl-lang.org/page/Tk+differences+on+Mac+OS+X (see following) 
suggests that dark mode is not enabled for the window (and yet we are getting 
white foreground colours)

import tkinter as tk
root = tk.Tk()
print(root.tk.call("tk::unsupported::MacWindowStyle", "isdark", "."))

I presume this is a MacOS 11 issue. I will look into raising this with the Tk 
team.

--

___
Python tracker 

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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

With some luck it might be possible to work around this. If it isn’t we should 
at least opt out of dark mode for IDLE by changing its Info.plist.


https://developer.apple.com/documentation/appkit/nsappearancecustomization/choosing_a_specific_appearance_for_your_macos_app

https://wiki.tcl-lang.org/page/Tk+differences+on+Mac+OS+X

BTW. @epaine: could you file an issue about this in the Tk tracker if you can 
reproduce it directly with Tk (without Tkinter)?

--

___
Python tracker 

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



[issue42521] Debug (-d) mode not working in 3.9

2020-12-02 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue41625] Add splice() to the os module

2020-12-02 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue41625] Add splice() to the os module

2020-12-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset dedc2cd5f02a2e2fc2c995a36a3dccf9d93856bb by Pablo Galindo in 
branch 'master':
bpo-41625: Do not add os.splice on AIX due to compatibility issues (GH-23608)
https://github.com/python/cpython/commit/dedc2cd5f02a2e2fc2c995a36a3dccf9d93856bb


--

___
Python tracker 

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



[issue42521] Debug (-d) mode not working in 3.9

2020-12-02 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +22483
pull_request: https://github.com/python/cpython/pull/23615

___
Python tracker 

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



[issue42521] Debug (-d) mode not working in 3.9

2020-12-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 99b594404d364b363c184f48338d6ee81bee26dd by Pablo Galindo in 
branch 'master':
bpo-42521: Add note about 'Python -d' only working on debug builds (GH-23607)
https://github.com/python/cpython/commit/99b594404d364b363c184f48338d6ee81bee26dd


--

___
Python tracker 

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



[issue40939] Remove the old parser

2020-12-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> On Windows there is PC/python3dll.c.

Even that is severely out of date, unfortunately. There are many functions that 
were removed in 3.8 and 3.7 that are still listed there.

--

___
Python tracker 

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



[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2020-12-02 Thread Brett Cannon


Change by Brett Cannon :


--
nosy: +barry, jaraco -brett.cannon

___
Python tracker 

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



[issue42507] test_ttk_guionly test failures on macOS with Tcl/Tk 8.6.10

2020-12-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

It might be the tk/tkinter build, not the tests, that is at fault.  That is my 
current conclusion for #42508 (regarding IDLE as a test).

--
nosy: +terry.reedy

___
Python tracker 

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



[issue42508] macOS IDLE with Tk 8.6.10 in 3.9.1rc1 universal2 installer fails smoke test

2020-12-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The new tk/tkinter bug in the macOS11 U2 build, other than those reported in 
#42507 and #42541, is that pressing F5 causes the corresponding pseudoevent 
handler, run_module_event, to be called twice.  (Its code is above.)  The 
interval between calls is about 1 millesecond -- .7 to 1.1 in 5 tries.  See 
this by adding the following at the top of the function's and subtracting after 
running code with or without syntax  error.
  print('run', time.perf_counter())

Adding multiple prints in _run_module_event shows the following for code that 
compiles.  With the 200 millesecond cocoa delay, the two calls run interleaved 
closely interleaved.  I don't understand the details, but the result is the 
scrambled and incorrect output given above.  With no delay as with PR 23577, 
the first call calls restart_subprocess in _run_module_event.  Then call 2 gets 
to the top of this function, then call 1 appears to finish, and call 2 is 
somehow aborted.

With a syntax error, the 2nd call, redisplaying the error, is not aborted.

F5 resulting in two calls is not unique, even though I have not yet seen overt 
double call effects.  In Shell, Control-F6 restarts.  A print in its event 
handler shows that it is called twice even though there is only 1 restart.

A possible kludge workaround would be to call perf_counter when the class is 
created and for Cocoa, each run_module call.  Return when new-old < 
2milliseconds.  But the double call should be fixed as it could show up 
elsewhere.

--
nosy: +serhiy.storchaka, wordtech

___
Python tracker 

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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread E. Paine


E. Paine  added the comment:

I just compiled Tk 8.6.10 and it has the same problems. So the question now is 
whether we work-around it in Tkinter/IDLE or close this issue as third party.

--

___
Python tracker 

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



[issue40939] Remove the old parser

2020-12-02 Thread Nikita Nemkin


Nikita Nemkin  added the comment:

> Unfortunately there is no official maintained list if those symbols, so is 
> taking a while

On Windows there is PC/python3dll.c.

--

___
Python tracker 

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



[issue40939] Remove the old parser

2020-12-02 Thread Igor Skochinsky


Igor Skochinsky  added the comment:

> I am currently working on test that checks that the stable API symbols are 
> correctly exported.

Thank you very much! For added motivation, the 3.8.0 release was unusable 
thanks to issue37633 which was somewhat similar (also in pythonrun). For 
reference, I've attached a list of symbols we currently use (a few more we have 
to import dynamically since they're not in the stable ABI but we'd like to keep 
that list as short as possible).

--
Added file: https://bugs.python.org/file49647/py3.txt

___
Python tracker 

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



[issue40939] Remove the old parser

2020-12-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am currently working on test that checks that the stable API symbols are 
correctly exported. Unfortunately there is no official maintained list if those 
symbols, so is taking a while

--

___
Python tracker 

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



[issue42543] case sensitivity in open() arguments

2020-12-02 Thread Sean Grogan


New submission from Sean Grogan :

I was stuck on a problem today using an open statement where I was trying to 
open a file for writing

e.g. 

with open("RESULTS.CSV", "W") as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerow(["X", "Y"])
csvwriter.writerows(data) 

I did not notice I had the mode W in upper case. I am not sure if there is a 
legacy reason for only allowing lower case arguments here but I think a quick 
note in the documentation that it's case sensitive or a check (or note) when 
throwing an error would be helpful?  such as 

ValueError: invalid mode: 'W' -- your case appears to be an upper case, 
please ensure the case of the mode is correct

or 

ValueError: invalid mode: 'W' -- note the mode is case sensitive

could be helpful?

--
assignee: docs@python
components: Documentation
messages: 382322
nosy: docs@python, sean.grogan
priority: normal
severity: normal
status: open
title: case sensitivity in open() arguments
type: behavior
versions: Python 3.6, 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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

The problem seems to be that the window background doesn't adjust to dark mode, 
while the window contents does.  

I don't know if we should do something in Tkinter for this.

--

___
Python tracker 

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



[issue14111] IDLE Debugger should handle interrupts

2020-12-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Mark, since you are working on redoing the debugger gui, do you have any 
opinion on this?  The basic idea is that ^C when debugging should just 
interrupt the remote process, not end it, just as when there is no debugger.  I 
agree.

I just updated the PR to current master but have not at the moment tested it.

--
nosy:  -roger.serwy
versions: +Python 3.10 -Python 3.7

___
Python tracker 

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



[issue42542] weakref documentation does not fully describe proxies

2020-12-02 Thread Ryan Govostes


New submission from Ryan Govostes :

The documentation for weakref.proxy() does not describe how the proxy object 
behaves when the object it references is gone.

The apparent behavior is that it raises a ReferenceError when an attribute of 
the proxy object is accessed.

It would probably be a good idea to describe what the proxy object does in 
general, for those who are unfamiliar with the concept: attribute accesses on 
the proxy object are forwarded to the referenced object, if it exists.

--
assignee: docs@python
components: Documentation
messages: 382319
nosy: docs@python, rgov
priority: normal
severity: normal
status: open
title: weakref documentation does not fully describe proxies
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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread E. Paine


E. Paine  added the comment:

Sorry, that was an important piece of information. It is worth noting that Text 
widgets correctly change background to black.

--

___
Python tracker 

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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread E. Paine


E. Paine  added the comment:

> Are you running in dark mode?

Yes. It works fine in light mode.

--

___
Python tracker 

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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Are you running in dark mode?

--

___
Python tracker 

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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread E. Paine


Change by E. Paine :


Added file: 
https://bugs.python.org/file49646/Screenshot-2020-12-02-at-12-46-06.png

___
Python tracker 

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



[issue42541] Tkinter colours wrong on MacOS universal2

2020-12-02 Thread E. Paine


New submission from E. Paine :

When using tkinter from the universal2 package, the colours are completely 
confused. Most text tries to white, even though the background is light and 
this makes text in Entries completely unreadable (where the background is 
white). This affects both Tk and Ttk.

The first included screenshot is of a simple script which just creates a Tk 
label and Ttk label. The second screenshot is of the IDLE 'open module' 
interface in which I have typed 'test' (though, you cannot see this).

The main problem is that I cannot check whether this is a Tkinter or Tk issue 
as ActiveTcl only offers 8.6.9 and I haven't yet compiled my own copy of Tk.

This is not a problem on the standard installer.

--
components: Tkinter, macOS
files: Screenshot from 2020-12-02 14-37-02.png
messages: 382315
nosy: epaine, ned.deily, ronaldoussoren, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Tkinter colours wrong on MacOS universal2
versions: Python 3.10, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49645/Screenshot from 2020-12-02 
14-37-02.png

___
Python tracker 

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



[issue42540] Debug pymalloc crash when using os.fork() [regression]

2020-12-02 Thread CendioOssman


New submission from CendioOssman :

A python equivalent of the classical daemon() call started throwing an error 
from 3.8 when the debug hooks are active for pymalloc. If the tracing is also 
active it segfaults.

This simple example triggers it:


import os

def daemon():
pid = os.fork()
if pid != 0:
os._exit(0)

daemon()


The error given is:

Debug memory block at address p=0xf013d0: API '1'
0 bytes originally requested
The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfd):
at p-7: 0x00 *** OUCH
at p-6: 0x00 *** OUCH
at p-5: 0x00 *** OUCH
at p-4: 0x00 *** OUCH
at p-3: 0x00 *** OUCH
at p-2: 0x00 *** OUCH
at p-1: 0x00 *** OUCH
Because memory is corrupted at the start, the count of bytes requested
   may be bogus, and checking the trailing pad bytes may segfault.
The 8 pad bytes at tail=0xf013d0 are not all FORBIDDENBYTE (0xfd):
at tail+0: 0x01 *** OUCH
at tail+1: 0x00 *** OUCH
at tail+2: 0x00 *** OUCH
at tail+3: 0x00 *** OUCH
at tail+4: 0x00 *** OUCH
at tail+5: 0x00 *** OUCH
at tail+6: 0x00 *** OUCH
at tail+7: 0x00 *** OUCH

Enable tracemalloc to get the memory block allocation traceback

Fatal Python error: bad ID: Allocated using API '1', verified using API 'r'
Python runtime state: finalizing (tstate=0xf023b0)



Tested on Fedora, Ubuntu and RHEL with the same behaviour everwhere. Everything 
up to 3.8 works fine. 3.8 and 3.9 both exhibit the issue.

Since this is a very standard way of starting a daemon it should affect quite a 
few users. At the very least it makes it annoying to use development mode to 
catch other issues.

--
components: Interpreter Core
messages: 382314
nosy: CendioOssman
priority: normal
severity: normal
status: open
title: Debug pymalloc crash when using os.fork() [regression]
type: crash
versions: Python 3.10, 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



[issue42539] Missing parenthesis in `platform._sys_version_parser`

2020-12-02 Thread Mingchii Suen


New submission from Mingchii Suen :

in `platform.py`, `_sys_version_parser`
the last part of regex is `r'\[([^\]]+)\]?'`
which should be `r'(?:\[([^\]]+)\])?'

without this change, the question mark only make the last `\]` optional, not 
the whole part optional

this will cause unable to detect python implementation issue in some custom 
build python if the `[compiler]` part in `sys.version` is missing

will make a pull request soon
I have o

--
components: Library (Lib)
messages: 382313
nosy: crazy95sun
priority: normal
severity: normal
status: open
title: Missing parenthesis in `platform._sys_version_parser`
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue42500] crash with unbounded recursion in except statement

2020-12-02 Thread Mark Shannon


Change by Mark Shannon :


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



[issue42246] Implement PEP 626

2020-12-02 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 5977a7989d49c3e095c7659a58267d87a17b12b1 by Mark Shannon in 
branch 'master':
bpo-42246: Make sure that line number is correct after a return, as required by 
PEP 626 (GH-23495)
https://github.com/python/cpython/commit/5977a7989d49c3e095c7659a58267d87a17b12b1


--

___
Python tracker 

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



[issue42500] crash with unbounded recursion in except statement

2020-12-02 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 4e7a69bdb63a104587759d7784124492dcdd496e by Mark Shannon in 
branch 'master':
bpo-42500: Fix recursion in or after except (GH-23568)
https://github.com/python/cpython/commit/4e7a69bdb63a104587759d7784124492dcdd496e


--

___
Python tracker 

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



[issue42538] AsyncIO strange behaviour

2020-12-02 Thread Alexander Greckov


Alexander Greckov  added the comment:

Thanks! That's resolved my problem, but this thing wasn't really obvious as for 
me. Probably it would be better to write about this explicitly in docs for the 
create_task. All in all this issue can be closed.

--

___
Python tracker 

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



[issue42536] test_itertools leaks sometimes references

2020-12-02 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue42537] Implement built-in shorthand b() for breakpoint()

2020-12-02 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +barry

___
Python tracker 

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



[issue42538] AsyncIO strange behaviour

2020-12-02 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

I understand the issue as the following:

1. You don't save the result of `asyncio.create_task()` somewhere.
The task object is dereferenced and thus you see a warning.

2. With PYTHONASYNCIODEBUG on the task is referenced also by internal debug 
structure, that's why you don't see the warning.

Perhaps we should store a weak reference to task in _source_traceback

Minor thing but nice to have it fixed.

--

___
Python tracker 

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



  1   2   >