[issue42646] Add function that supports "applying" methods

2020-12-15 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

If you're annoyed by having to use two lines, one to copy, one to call the 
mutating method, you can use the walrus operator:

(y := x.copy()).some_method()

or:

(y := deepcopy(x)).some_method()

Does that cover your use case?

For the list case, you'd normally just do:

arr = lis[::-1]

but:

(arr = lis.copy()).reverse()

also works.

Granted, not super pretty. But I'm not seeing enough cases where this ugliness 
is truly unavoidable (the two lines don't bother me that much, and for 
built-ins, there is usually a one-liner that works fine, e.g. the reversing 
slice as shown, sorted over list.sort, etc.).

I'll note: Unconditionally calling copy.copy is fine; it knows to try the 
__copy__ method of the things it is called on (and most things that offer copy 
alias it to __copy__ or are special-cased in copy.copy as well; if they don't, 
they should), so you're unlikely to need to perform the "try method, fall back 
to copy.copy" yourself.

--
nosy: +josh.r

___
Python tracker 

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



[issue42115] Caching infrastructure for the evaluation loop: specialised opcodes

2020-12-15 Thread Inada Naoki


Inada Naoki  added the comment:

$ ./python -m pyperf compare_to master.json load_method.json -G --min-speed=1
Slower (15):
- unpack_sequence: 63.2 ns +- 0.8 ns -> 68.5 ns +- 14.8 ns: 1.08x slower (+8%)
- pathlib: 23.1 ms +- 0.3 ms -> 24.4 ms +- 0.4 ms: 1.05x slower (+5%)
- scimark_fft: 418 ms +- 2 ms -> 433 ms +- 3 ms: 1.04x slower (+4%)
- scimark_monte_carlo: 113 ms +- 2 ms -> 116 ms +- 3 ms: 1.03x slower (+3%)
- unpickle_list: 5.30 us +- 0.03 us -> 5.44 us +- 0.28 us: 1.03x slower (+3%)
- nqueens: 107 ms +- 1 ms -> 109 ms +- 3 ms: 1.02x slower (+2%)
- spectral_norm: 154 ms +- 1 ms -> 157 ms +- 1 ms: 1.02x slower (+2%)
- float: 136 ms +- 1 ms -> 138 ms +- 1 ms: 1.02x slower (+2%)
- unpickle_pure_python: 324 us +- 3 us -> 329 us +- 4 us: 1.02x slower (+2%)
- genshi_xml: 71.9 ms +- 1.9 ms -> 73.1 ms +- 1.0 ms: 1.02x slower (+2%)
- scimark_sparse_mat_mult: 5.54 ms +- 0.03 ms -> 5.63 ms +- 0.03 ms: 1.02x 
slower (+2%)
- regex_effbot: 3.45 ms +- 0.14 ms -> 3.49 ms +- 0.04 ms: 1.01x slower (+1%)
- sqlite_synth: 3.37 us +- 0.06 us -> 3.41 us +- 0.07 us: 1.01x slower (+1%)
- regex_v8: 27.0 ms +- 0.2 ms -> 27.3 ms +- 0.1 ms: 1.01x slower (+1%)
- pickle_dict: 29.7 us +- 0.1 us -> 30.1 us +- 0.2 us: 1.01x slower (+1%)

Faster (10):
- go: 256 ms +- 3 ms -> 246 ms +- 2 ms: 1.04x faster (-4%)
- pickle_pure_python: 497 us +- 5 us -> 478 us +- 5 us: 1.04x faster (-4%)
- logging_simple: 9.84 us +- 0.17 us -> 9.48 us +- 0.22 us: 1.04x faster (-4%)
- mako: 17.1 ms +- 0.2 ms -> 16.5 ms +- 0.2 ms: 1.03x faster (-3%)
- logging_format: 10.9 us +- 0.2 us -> 10.6 us +- 0.2 us: 1.03x faster (-3%)
- logging_silent: 201 ns +- 6 ns -> 198 ns +- 5 ns: 1.02x faster (-2%)
- meteor_contest: 125 ms +- 1 ms -> 123 ms +- 0 ms: 1.02x faster (-2%)
- json_loads: 32.0 us +- 0.3 us -> 31.6 us +- 0.2 us: 1.01x faster (-1%)
- sqlalchemy_imperative: 37.8 ms +- 0.9 ms -> 37.4 ms +- 1.0 ms: 1.01x faster 
(-1%)
- unpickle: 14.5 us +- 0.3 us -> 14.3 us +- 0.1 us: 1.01x faster (-1%)

Benchmark hidden because not significant (35): 2to3, chameleon, chaos, 
crypto_pyaes, deltablue, django_template, dulwich_log, fannkuch, genshi_text, 
hexiom, json_dumps, nbody, pickle, pickle_list, pidigits, pyflate, 
python_startup, python_startup_no_site, raytrace, regex_compile, regex_dna, 
richards, scimark_lu, scimark_sor, sqlalchemy_declarative, sympy_expand, 
sympy_integrate, sympy_sum, sympy_str, telco, tornado_http, xml_etree_parse, 
xml_etree_iterparse, xml_etree_generate, xml_etree_process

Geometric mean: 1.00 (slower)

--
Added file: https://bugs.python.org/file49684/results.zip

___
Python tracker 

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



[issue39416] Document default numeric string formats

2020-12-15 Thread Éric Araujo

Éric Araujo  added the comment:


New changeset aedc94b8e9d0f7700c665d8d1ba9c93df33e63a8 by Miss Islington (bot) 
in branch '3.8':
[3.8] bpo-39416: change word case to not imply ABC (GH-22867) (GH-22869)
https://github.com/python/cpython/commit/aedc94b8e9d0f7700c665d8d1ba9c93df33e63a8


--

___
Python tracker 

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



[issue42125] linecache cannot get source for the __main__ module with a custom loader

2020-12-15 Thread Eugene Toder


Change by Eugene Toder :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue42179] Clarify chaining exceptions in tutorial/errors.rst

2020-12-15 Thread Carol Willing


Carol Willing  added the comment:


New changeset 3f9fe23c05280dc5736c07bb0e968cdaf8c503d0 by Vladimir in branch 
'master':
bpo-42179: Clarify exception chaining (GH-23160)
https://github.com/python/cpython/commit/3f9fe23c05280dc5736c07bb0e968cdaf8c503d0


--

___
Python tracker 

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



[issue42090] zipfile.Path.joinpath API inconsistent with pathlib.Path.joinpath

2020-12-15 Thread miss-islington


miss-islington  added the comment:


New changeset 928dbfc16c9c4715459c80fe551c74702480db8b by Jason R. Coombs in 
branch 'master':
bpo-42090: zipfile.Path.joinpath now accepts multiple arguments (GH-22976)
https://github.com/python/cpython/commit/928dbfc16c9c4715459c80fe551c74702480db8b


--
nosy: +miss-islington

___
Python tracker 

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



[issue35930] Raising an exception raised in a "future" instance will create reference cycles

2020-12-15 Thread Jesús Cea Avión

Change by Jesús Cea Avión :


--
versions: +Python 3.8, Python 3.9

___
Python tracker 

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



[issue35930] Raising an exception raised in a "future" instance will create reference cycles

2020-12-15 Thread Jesús Cea Avión

Jesús Cea Avión  added the comment:

Even more reproductible case, now 100%:

"""
import gc
import concurrent.futures
executor = concurrent.futures.ThreadPoolExecutor(999)

def a():
  1/0

future=executor.submit(a)
future.result()
# An exception is raised here. That is normal
del future  # Variable vanish, but data is still there because the cycle
1/0  # Raises another exception drop references to the future one
gc.set_debug(gc.DEBUG_SAVEALL)
gc.collect()
gc.garbage
"""

--

___
Python tracker 

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



[issue42648] subprocess: add a helper/parameter to catch exec() OSError exception

2020-12-15 Thread Eryk Sun


Eryk Sun  added the comment:

I suggesting changing the name to indicate that only OSError exceptions are 
suppressed, not SubprocessError exceptions. Maybe call it no_oserror.

As to the status code to use, if you want a a common code that can't interfere, 
it has to be either a negative value that can't be confused with a POSIX signal 
value or, if non-negative, it has to be at least 2**32, since a status code in 
Windows can be any non-negative 32-bit value.

> The shell is fast.  I'd just use the shell when replacing os.popen 
> uses in tests.

POSIX functions os.system() and os.popen() should be avoided if there's a 
chance of shell injection, but if you'll be using shell=True anyway, then 
what's the value in rewriting the code? os.popen() already uses 
subprocess.Popen() with shell=True.

--
nosy: +eryksun

___
Python tracker 

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



[issue42648] subprocess: add a helper/parameter to catch exec() OSError exception

2020-12-15 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

arguably run() with check=True could've turned the OSError into a 
CalledProcessError [can't do that now, someone surely depends on it].  So if 
both are supplied, perhaps it does that instead of returning a CompletedProcess 
with .oserror set?

the API surface we've accumulated in subprocess over the decades is huge. :(

--

___
Python tracker 

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



[issue42648] subprocess: add a helper/parameter to catch exec() OSError exception

2020-12-15 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

We could also be thinking too low level here.  We don't have to re-use 
returncode for this or do it on POpen itself.  This could be done at the 
`run()` API level and CompletedProcess could be given state indicating success 
or failure of the exec itself.

ex: Add a `capture_oserror=` arg to `run()`.

```
>>> proc = subprocess.run(['foo'], capture_oserror=True)
>>> proc
CompletedProcess(args='foo', oserror=FileNotFoundError(2, 'No such file or 
directory'))
>>> if proc.failure:
...   
```

Add two properties to CompletedProcess:

```
@property
def success(self):
return bool(self.oserror is None and not self.returncode)

@property
def failure(self):
return bool(self.oserror or self.returncode)
```

to make using that an easy one liner.

Another thing that came up recently was someone wishing CompletedProcess had a 
`__bool__()` method.  I rejected that as it could break existing code already 
testing None vs CompletedProcess via truthiness.  But such a desire should be 
satisfied with the above .success and .failure properties.

--

___
Python tracker 

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



[issue42648] subprocess: add a helper/parameter to catch exec() OSError exception

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

I updated my PR 23790 to add many usage of the new parameter, to see which kind 
of code would benefit of it.

--

Use case: Get the output of a command, don't fail if the command doesn't exist. 
Example: get "gcc --version" output.

It's common to redirect stderr to /dev/null.

The advantage of having a parameter is the ability to continue using regular 
subprocess methods without having to bother with the "command not found" case:

   proc.communicate()
   proc.stdout.read()
   if proc.returncode: ...
   ...

--

Tools/scripts/patchcheck.py calls subprocess.check_output() and uses "except 
subprocess.CalledProcessError:" to ignore any command error. But it doesn't 
catch "OSError" if the command doesn't exist (ex: "git" in this case).

*Maybe* exec_raise=False should even be the default behavior for functions like 
check_output()? But changing the default behavior is always a challenge for the 
backward compatibility :-(

--

___
Python tracker 

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



[issue42648] subprocess: add a helper/parameter to catch exec() OSError exception

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

https://docs.python.org/dev/library/subprocess.html#subprocess-replacements 
documentation suggests to replace os.popen(cmd, "w") with Popen(cmd, 
stdin=PIPE): without shell=True. My problem is that the replacement does change 
the behavior if the command does not exist.

--

I would like to avoid a shell (shell=True) to avoid any risk of shell injection 
vulnerability, but also to avoid bugs caused by the usage of a shell.

For example, "*" is a joker character. "*.py" is expanded to the list of 
filenames ending with ".py", or left unchanged if there is no file with a name 
ending with ".py". It's surprising if you are not used to a shell, and you 
expect "*" to be passed to the final command.

There are other weird cases with a shell, like bpo-26124 "shlex.quote and 
pipes.quote do not quote shell keywords".

See bpo-42641 "Deprecate os.popen() function" for other examples.

--

___
Python tracker 

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



[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread Ivo Shipkaliev


Ivo Shipkaliev  added the comment:

First: thank you!

> I think Serhiy has done a very good job ...

I'm not saying he ain't! More so, I greatly appreciate everyone's time and 
effort. But I'm discussing the implementation here, not somebody's work.

Apparently I haven't been precise enough in conveying my message. Let me try to 
clarify what I mean. Consider the following:

An object gets initialized. The object's constructor accepts a "master" 
optional parameter (e.g. Variable.__init__). So, every time:
   -- "master" is None
  and
   -- _support_default_root is True
a default root must be instantiated. A master is optional, and when it's not 
given and _support_default_root switch is on, a default root should be 
supplied. That's the whole point of _support_default_root after all.

My understanding of the module is not as deep as yours', but getboolean(), 
mainloop() and image_types() shouldn't be affected.

"Too early to create image: no default root window": Why isn't there? When 
_support_default_root is on.

Again, I can see that:

> "no default root window" is correct

:But why is there no default window? Support default root is on, right?

> There is no yet default root window required by the function.

:A default root is required when you instantiate an Image without a "master". 
It's not required as an argument, but it is required for the operation of Image.
I'm suggesting something like:

> class Variable:
> ...
> def __init__(self, master=None, value=None, name=None):
> ...
> master = master or _get_default_root()
> self._root = master._root()
> ...

> class Image:
> ...
> def __init__(self, imgtype, name=None, cnf={}, master=None, **kw):
> ...
> master = master or _get_default_root()
> self.tk = getattr(master, 'tk', master)
> ...

Best Wishes
Ivo Shipkaliev

--

___
Python tracker 

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



[issue42648] subprocess: add a helper/parameter to catch exec() OSError exception

2020-12-15 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I suggest just adding a couple options to getstatusoutput instead of wrangling 
new to-catch-or-not-to-catch APIs if code like your test_posix example is what 
you want to replace.

--

___
Python tracker 

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



[issue14586] TypeError: truncate() takes no keyword arguments

2020-12-15 Thread Irit Katriel


Change by Irit Katriel :


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



[issue42648] subprocess: add a helper/parameter to catch exec() OSError exception

2020-12-15 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

The shell was isolating the user from the exec error by always existing and 
turning the exec error into a status return.

>>> subprocess.run('foo', shell=True)
/bin/sh: line 1: foo: command not found
CompletedProcess(args='foo', returncode=127)
>>> subprocess.getstatusoutput('foo')
(127, '/bin/sh: line 1: foo: command not found')

For things that don't actually _need_ the output as a pipe file (such as your 
.read() example), I recommend using .run() like that today and accessing the 
.stdout and .returncode attributes of the CompletedProcess.  Or use the old 
getstatusoutput() API if you don't mind stderr being included.

As far as new APIs go, yet another keyword only argument to subprocess.POpen's 
existing huge list that tells it to turn exec failures into a particular 
returncode value could be added as a feature.  Is this use case compelling 
enough to do that?

...

As far as distinguishing failures go, I suggest making such an API be to allow 
the user to specify a non-negative int to use as returncode - a unique int or 
one that is out of range such as a negative number or large number could be 
used to distinguish things if the user were so inclined or even an int subclass 
like True or an IntEnum value.  But lets keep it a non-negative int, not an 
arbitrary object.  Negative ints map to signals; using those would be confusing 
for CalledProcessError when a check constructs one.

```
>>> subprocess.run('foo', exec_fails_via_returncode=256)
CompletedProcess(args='foo', returncode=256)
```

With a default of exec_fails_via_returncode=None being the existing exception 
raising behavior.

That isn't joyful to use as an API.  So I don't expect most people would use it 
directly.  They'd have a wrapper function.  Ie: just another variation on 
getstatusoutput() that allows for use of a shell or stderr inclusion to be 
controlled.

The shell is fast.  I'd just use the shell when replacing os.popen uses in 
tests.

--

___
Python tracker 

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



[issue42648] subprocess: add a helper/parameter to catch exec() OSError exception

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote PR 23790 which adds exec_raise=True parameter to subprocess.Popen. 
exec_raise=False avoids try/except OSError.

I dislike the "exec_raise" parameter name. The function is not related to exec, 
but more specific to OSError. A better name may include "oserror", like 
"catch_oserror"?

The shutil.rmtree() has a "onerror" parameter. I don't know if it's a good 
inspiration for this feature.

--

___
Python tracker 

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



[issue2824] zipfile to handle duplicate files in archive

2020-12-15 Thread Irit Katriel


Irit Katriel  added the comment:

This was changed to a warning in issue20262. Is that enough or should it be an 
exception?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue42648] subprocess: add a helper/parameter to catch exec() OSError exception

2020-12-15 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue19206] Support disabling file I/O when doing traceback formatting

2020-12-15 Thread Irit Katriel


Irit Katriel  added the comment:

Since this issue was created, the traceback module changed considerably, and 
now we have the TracebackException/StackSummary classes which capture 
information about an exception for later rendering. The lookup_lines arg 
controls the timing of the file access: if it is false, this is delayed until 
render-time.

I believe this solves the use case of the logger - the file access can be 
delayed till the logger thread renders the exception. I'm not sure I understand 
the event loop use case, but presumably there, too, the exceptions are not 
being rendered (because we don't want IO during that loop).

--
nosy: +iritkatriel
resolution:  -> out of date
status: open -> pending
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



[issue42641] Deprecate os.popen() function

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

> document drawbacks and limitations of os.popen and advertise alternatives.

This sounds like a good idea in any case ;-)

--

___
Python tracker 

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



[issue35930] Raising an exception raised in a "future" instance will create reference cycles

2020-12-15 Thread Jesús Cea Avión

Jesús Cea Avión  added the comment:

The corrected test case in the terminal: (a "del" was missing)

"""
import gc
import concurrent.futures
executor = concurrent.futures.ThreadPoolExecutor(999)

def a():
  1/0

future=executor.submit(a)
future.result()
# An exception is raised here. That is normal
del future  # Variable vanish, but data is still there because the cycle
gc.set_debug(gc.DEBUG_SAVEALL)
gc.collect()
gc.garbage
"""

--

___
Python tracker 

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



[issue31904] Python should support VxWorks RTOS

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b230409f21f5e5b42de6ec10147cd95ae3bdd095 by pxinwr in branch 
'master':
bpo-31904: Skip os.path.expanduser() tests on VxWorks (GH-23776)
https://github.com/python/cpython/commit/b230409f21f5e5b42de6ec10147cd95ae3bdd095


--

___
Python tracker 

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



[issue31904] Python should support VxWorks RTOS

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9a0dea6137a9fe295c8b03aaa08a74c8572ecc4e by pxinwr in branch 
'master':
bpo-31904: Skip some tests of changing owner in _test_all_chown_common() on 
VxWorks (GH-23716)
https://github.com/python/cpython/commit/9a0dea6137a9fe295c8b03aaa08a74c8572ecc4e


--

___
Python tracker 

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



[issue31904] Python should support VxWorks RTOS

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e1e3c2dac3da8a179f57bd3e3309ab65385bcc8a by pxinwr in branch 
'master':
bpo-31904: Disable os.popen and popen test cases on VxWorks (GH-21687)
https://github.com/python/cpython/commit/e1e3c2dac3da8a179f57bd3e3309ab65385bcc8a


--

___
Python tracker 

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



[issue24743] Make _PyTraceback_Add public

2020-12-15 Thread Irit Katriel


Irit Katriel  added the comment:

This seems like something that needs to be discussed on python-ideas before it 
can be brought to implementation.

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

___
Python tracker 

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



[issue1514420] Traceback display code can attempt to open a file named ""

2020-12-15 Thread Irit Katriel


Irit Katriel  added the comment:

Ok, I'm unconfused now - this is the C version of the traceback, in 
_Py_DisplaySourceLine, not the traceback.py one that uses linecache.

It wouldn't be hard to add the check for "<>" in the filename there. Is there a 
reason not to do it?

--

___
Python tracker 

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



[issue40219] ttk LabeledScale: label covered by hidden element

2020-12-15 Thread miss-islington


miss-islington  added the comment:


New changeset 13d40c2a418116797eccd77bd65e4dbd689008db by Miss Islington (bot) 
in branch '3.8':
bpo-40219: Lowered ttk LabeledScale dummy (GH-21467)
https://github.com/python/cpython/commit/13d40c2a418116797eccd77bd65e4dbd689008db


--

___
Python tracker 

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



[issue14935] PEP 384 Refactoring applied to _csv module

2020-12-15 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions: +Python 3.10 -Python 3.4

___
Python tracker 

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



[issue40219] ttk LabeledScale: label covered by hidden element

2020-12-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22646
pull_request: https://github.com/python/cpython/pull/23789

___
Python tracker 

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



[issue40219] ttk LabeledScale: label covered by hidden element

2020-12-15 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue40219] ttk LabeledScale: label covered by hidden element

2020-12-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b9ced83cf427ec86802ba4c9a562c6d9cafc72f5 by E-Paine in branch 
'master':
bpo-40219: Lowered ttk LabeledScale dummy (GH-21467)
https://github.com/python/cpython/commit/b9ced83cf427ec86802ba4c9a562c6d9cafc72f5


--

___
Python tracker 

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



[issue38661] Changes to tkinter result in (unexpected) widget map call return changes wrt. 3.7

2020-12-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This was likely caused by different versions of Tk.

It should be fixed now in issue42328. Style.map() should convert result to 
uniform representation on all versions and platforms, and accept input in 
different forms. Please check.

--
resolution:  -> duplicate
status: open -> pending
superseder:  -> ttk style.map function incorrectly handles the default state 
for element options.

___
Python tracker 

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



[issue42577] Unhelpful syntax error when expression spans multiple lines

2020-12-15 Thread Guido van Rossum


Guido van Rossum  added the comment:

I think something should probably be done about this, but opening another 
tracker issue is not the way to make progress here. So I am closing the issue. 
It will happen in due time. No need to have more open issues.

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



[issue42650] Can people use dest=argparse.SUPPRESS in custom Action classes?

2020-12-15 Thread Brad Warren


New submission from Brad Warren :

argparse internally sets dest=SUPPRESS in action classes like _HelpAction and 
_VersionAction to prevent an attribute from being created for that option on 
the resulting namespace.

Can users creating custom Action classes also use this functionality without 
worrying about it suddenly breaking in a new version of Python? If so, can we 
document this functionality? I'd be happy to submit a PR.

--
assignee: docs@python
components: Documentation
messages: 383089
nosy: bmw, docs@python
priority: normal
severity: normal
status: open
title: Can people use dest=argparse.SUPPRESS in custom Action classes?
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



[issue42318] [tkinter] surrogate pairs in Tcl/Tk string when pasting an emoji in a text widget

2020-12-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 28bf6ab61f77c69b732a211c398ac882bf3f65f4 by Serhiy Storchaka in 
branch '3.9':
[3.9] bpo-42318: Fix support of non-BMP characters in Tkinter on macOS 
(GH-23281). (GH-23784)
https://github.com/python/cpython/commit/28bf6ab61f77c69b732a211c398ac882bf3f65f4


--

___
Python tracker 

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



[issue42318] [tkinter] surrogate pairs in Tcl/Tk string when pasting an emoji in a text widget

2020-12-15 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +22644
pull_request: https://github.com/python/cpython/pull/23787

___
Python tracker 

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



[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Currently, a root window is created implicitly only when you create a Tkinter 
or Ttk widget. i.e. things which should be visible to user. When you create 
image, variable, or use global utility function like getbool() or mainloop() or 
image_types() it raises an error: AttributeError or NamedError, or sometimes 
RuntimeError with error message like "Too early to create image: no default 
root window". With PR 23781 it will always raise RuntimeError instead of 
AttributeError or NamedError with corresponding error message.

"no default root window" is correct. There is no yet default root window 
required by the function. After you create it, explicitly or implicitly, you 
could use that function.

It could be odd if image_type() will successfully return a result with a side 
effect of popping up a window.

--

___
Python tracker 

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



[issue42644] logging.disable('WARN') breaks AsyncIO

2020-12-15 Thread Xavier Morel


Xavier Morel  added the comment:

Oh I now see you've created a PR to do essentially that, nm.

--

___
Python tracker 

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



[issue42644] logging.disable('WARN') breaks AsyncIO

2020-12-15 Thread Xavier Morel


Xavier Morel  added the comment:

> I think that patching logging.disable to raise a type error immediately would 
> be welcome

FWIW `logging` has a built-in checker / converter[0] which is already used in a 
bunch of places (e.g. the aforementioned setLevel), it could just be added 
inside `disable` in the same way it's used in setLevel[1] and would uniformly 
convert "level names" to proper levels or raise an error. That seems like a 
really easy patch / contribution.

[0] https://github.com/python/cpython/blob/3.9/Lib/logging/__init__.py#L189

[1] https://github.com/python/cpython/blob/3.9/Lib/logging/__init__.py#L906

--

___
Python tracker 

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



[issue42644] logging.disable('WARN') breaks AsyncIO

2020-12-15 Thread Matthias Bussonnier


Change by Matthias Bussonnier :


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

___
Python tracker 

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



[issue42649] RecursionError when parsing unwieldy expression (regression from 2.7 -> 3.x)

2020-12-15 Thread Michael Orlitzky


Change by Michael Orlitzky :


--
type:  -> compile error

___
Python tracker 

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



[issue42649] RecursionError when parsing unwieldy expression (regression from 2.7 -> 3.x)

2020-12-15 Thread Michael Orlitzky


New submission from Michael Orlitzky :

The attached file contains a huge, ugly expression that can be parsed in 
python-2.7 but not python-3.x (I've tested 3.7, 3.8, and 3.9). With the 3.x 
versions, I get

  $ python3 DPT_defn 
  RecursionError: maximum recursion depth exceeded during compilation

Python-2.7, on the other hand, is able to parse & compile much larger 
expressions -- this example was whittled down until it was roughly minimal.

--
components: Interpreter Core
files: DPT_defn
messages: 383084
nosy: mjo
priority: normal
severity: normal
status: open
title: RecursionError when parsing unwieldy expression (regression from 2.7 -> 
3.x)
versions: Python 3.9
Added file: https://bugs.python.org/file49683/DPT_defn

___
Python tracker 

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



[issue42644] logging.disable('WARN') breaks AsyncIO

2020-12-15 Thread Matthias Bussonnier


Matthias Bussonnier  added the comment:

I should have been more careful in my explanation in the upstream issue to have 
a complete report in here. 

I think that patching logging.disable to raise a type error immediately would 
be welcome; as the effect of storing a wrong type make any asyncio application 
fails in place that can be relatively remote from the location of the erroneous 
value, and could be quite hard to debug in other circumstances.

--
nosy: +mbussonn

___
Python tracker 

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



[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread E. Paine


E. Paine  added the comment:

> In my view, we should always create a default root if it's needed

I somewhat disagree. I think Serhiy has done a very good job (in what I've 
reviewed so far) of balancing when a new root should or shouldn't be created 
(e.g. does it make sense to create a new root when calling `getboolean` as this 
should only be called once there is a Tcl object to be processed?).

We also have the consideration of backwards compatibility as some weird script 
may rely upon such errors to, for example, detect when a root has not already 
been created.

--

___
Python tracker 

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



[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread Ivo Shipkaliev


Ivo Shipkaliev  added the comment:

Thank you very much, fellows!

Serhiy, I'm lloking at Lib/tkinter/__init__.py changes. I'd like to share my 
thoughts on this:

I understand your concern: "But I am not sure what is better: raise error 
(RuntimeError) if the global function uses _default_root which is not 
initialized, or create the root widget implicitly."

In the new _get_default_root() function, first we check if Support Default Root 
in on:

290 > if not _support_default_root:

If we get passed this block, we know that Support Default Root is on, meaning 
that all entities that require a master, but didn't receive one passed-in, must 
receive a default one. That's how I perceive the whole idea behind Support 
Default Root.

But later on we do:

293 > if not _default_root:
294 > if what:
295 > raise RuntimeError(f"Too early to {what}: no default root 
window")

At this point, if "what" evaluates to True, we raise a RuntimeError. But at 
this same time Support Default Root is on, and there is no default root. And 
clearly: ".. no default root window" error contradicts the 
"_support_default_root" idea.

So further on, assuming Support Default Root is on, if we instantiate a 
Variable with master=None, we would get: "Too early to create variable: no 
default root window", which makes no sense.

In my view, we should always create a default root if it's needed, provided 
that _support_default_root is True. Simply: Support Default Root must lead to a 
default root.

Best Regards

--

___
Python tracker 

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



[issue42641] Deprecate os.popen() function

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

I created bpo-42648: "subprocess: add a helper/parameter to catch exec() 
OSError exception".

--

___
Python tracker 

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



[issue42641] Deprecate os.popen() function

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7f14a3756b61272cc15f24302589874b125c2f04 by Victor Stinner in 
branch 'master':
bpo-42641: Enhance test_select.test_select() (GH-23782)
https://github.com/python/cpython/commit/7f14a3756b61272cc15f24302589874b125c2f04


--

___
Python tracker 

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



[issue41969] ttk.RadioButtons mis-sized under Windows 10 UI Scaling, with dpiAware set true

2020-12-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> third party
status: open -> pending

___
Python tracker 

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



[issue42648] subprocess: add a helper/parameter to catch exec() OSError exception

2020-12-15 Thread STINNER Victor


New submission from STINNER Victor :

While working on on bpo-42641 "Deprecate os.popen() function", I tried to 
replace os.popen() with a subprocess function, to avoid relying on an external 
shell. Example from test_posix:

with os.popen('id -G 2>/dev/null') as idg:
groups = idg.read().strip()
ret = idg.close()

os.popen() uses a shell, and so returns an non-zero exit status if the "id" 
program is not available:

>>> import os; os.popen('nonexistent').close()
/bin/sh: nonexistent : commande introuvable
32512

whereas the subprocess module raises an OSError:

>>> import subprocess; proc=subprocess.run('nonexistent')
FileNotFoundError: [Errno 2] No such file or directory: 'nonexistent'

It's not convenient to have to write try/except OSError when replacing 
os.popen() with subprocess.run().

It would be convenient to have a subprocess API which avoid the need for 
try/except, if possible with keeping the ability to distinguish when exec() 
fails and when exec() completed but waitpid() returns a non-zero exit status 
(child process exit code is non-zero).

This issue becomes more interesting when subprocess uses os.posix_spawn(). The 
subprocess module only uses os.posix_spawn() if the libc implementation is 
known to report exec() failure: if os.posix_spawn() raises an OSError exception 
if exec() fails. See subprocess._use_posix_spawn() which uses 
os.confstr('CS_GNU_LIBC_VERSION') to check if the glibc 2.24+ is used.

Or maybe I simply missed a very obvious API in subprocess for this problem?

--
components: Library (Lib)
messages: 383078
nosy: gregory.p.smith, vstinner
priority: normal
severity: normal
status: open
title: subprocess: add a helper/parameter to catch exec() OSError exception
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



[issue38820] Make Python compatible with OpenSSL 3.0.0

2020-12-15 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy: +yan12125

___
Python tracker 

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



[issue41349] Tk window not going full screen on 90° rotated screen on mac

2020-12-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> third party
status: open -> pending

___
Python tracker 

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



[issue19733] Setting image parameter of a button crashes with Cocoa Tk

2020-12-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue42318] [tkinter] surrogate pairs in Tcl/Tk string when pasting an emoji in a text widget

2020-12-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +22641
pull_request: https://github.com/python/cpython/pull/23784

___
Python tracker 

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



[issue42318] [tkinter] surrogate pairs in Tcl/Tk string when pasting an emoji in a text widget

2020-12-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Oh, the fix is not backported yet.

Automatically backporting does not work because of renames in the supporting 
test library.

--

___
Python tracker 

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



[issue21521] Tkinter + OSX + Spaces : Multiple file dialogues created

2020-12-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

asksaveasfilename is just a wrapper around the tk_getSaveFile Tk command which 
is implemented differently on Windows, macOS and X Window. The used widgets 
have very different appearance and behavior on different platforms, so there is 
no chance to test macOS issues on Windows or Linux. On Linux at least it 
honoures initialdir='.'.

In any case Tkinter just converts arguments and results of the Tk command. It 
does not affect the appearance and behavior. We cannot do anything to fix bugs 
in Tk.

--
nosy: +serhiy.storchaka
resolution:  -> third party
status: open -> pending

___
Python tracker 

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



[issue42641] Deprecate os.popen() function

2020-12-15 Thread STINNER Victor


Change by STINNER Victor :


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

___
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-15 Thread Julien Palard


Julien Palard  added the comment:


New changeset c8a10d2fabff492ab352501c316baf5f2fc6510e by Julien Palard in 
branch 'master':
bpo-36675: Doc: Reveal doctest directives (GH-23620)
https://github.com/python/cpython/commit/c8a10d2fabff492ab352501c316baf5f2fc6510e


--

___
Python tracker 

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



[issue24893] Tk occasionally mispositions Text() insert cursor on mouse click.

2020-12-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue42641] Deprecate os.popen() function

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

> check2 = os.popen('grep "net\.ipv4\.ip_forward" /etc/sysctl.conf 
> /etc/sysctl.d/*').read()

Such code leaks a zombi process when the child process completes, because the 
parent never reads its exit status :-(

--

___
Python tracker 

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



[issue42639] Make atexit state per interpreter

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, the initial issue is now fixed. It's possible to have more than one atexit 
module instance, registered callbacks in one or the other module are all called 
as expected. I also wrote an unit test for that.

I also took the opportunity of this issue to modernize the C code base, fix a 
bug in test_atexit (no longer clear atexit callbacks, run tests in 
subprocesses), and enhance atexit._run_exitfuncs(): log all callback exceptions 
using sys.unraisablehook so it's possible to catch them using the hook.

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



[issue42142] test_ttk timeout: FAIL tkinter ttk LabeledScale test_resize, and more

2020-12-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There should be no timeouts (because wait_visibility no longer is used in 
tests). The fix can introduce new failures (like in issue42507), but it is a 
separate issue and may be related to bugs in the implementation of Tk on macOS.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8, Python 3.9

___
Python tracker 

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



[issue42639] Make atexit state per interpreter

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3ca2b8fd75043927f0bb03b8dac72d32beae255d by Victor Stinner in 
branch 'master':
bpo-42639: atexit._run_exitfuncs() uses sys.unraisablehook (GH-23779)
https://github.com/python/cpython/commit/3ca2b8fd75043927f0bb03b8dac72d32beae255d


--

___
Python tracker 

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



[issue42328] ttk style.map function incorrectly handles the default state for element options.

2020-12-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue42630] Variable.__init__ raises obscure AttributeError

2020-12-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +22639
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23781

___
Python tracker 

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



[issue42645] break/continue or return in finally block occurs twice in trace.

2020-12-15 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue42035] [C API] PyType_GetSlot cannot get tp_name

2020-12-15 Thread Petr Viktorin


Petr Viktorin  added the comment:

I'll be happy to review adding a PyType_GetName function.

--

___
Python tracker 

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



[issue26515] Update extending/embedding docs to new way to build modules in C

2020-12-15 Thread Petr Viktorin


Petr Viktorin  added the comment:

PEP 630 is now Active. I believe the vast majority of modules can now be 
ported, and it should be helpful for early adopters (including CPython stdlib). 
But there are still Open Issues and the API not battle-tested on all the edge 
cases.

The PEP is written to be easily integrated into official docs when the time 
comes.

--

___
Python tracker 

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



[issue14935] PEP 384 Refactoring applied to _csv module

2020-12-15 Thread Petr Viktorin


Petr Viktorin  added the comment:

Thank you for working on this!
It took several years and some new C-API to get it right (see PEP 630), but I 
believe this and the related issues bpo-18710 and bpo-34533 can now be closed.

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ceb420251c1d635520049fbb7b5269a73d63fb58 by Victor Stinner in 
branch 'master':
bpo-32381: pymain_run_file() uses PySys_FormatStderr() (GH-23778)
https://github.com/python/cpython/commit/ceb420251c1d635520049fbb7b5269a73d63fb58


--

___
Python tracker 

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



[issue42646] Add function that supports "applying" methods

2020-12-15 Thread Eric V. Smith


Eric V. Smith  added the comment:

This seems way too special case for the stdlib, and especially not as a 
builtin. I've never seen this pattern before. Why is copy so special?

I suggest raising this on the python-ideas mailing list if you'd like to get 
some traction for it.

--
nosy: +eric.smith
type:  -> enhancement

___
Python tracker 

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



[issue18710] Add PyState_GetModuleAttr

2020-12-15 Thread Petr Viktorin


Petr Viktorin  added the comment:

Let me summarize the original issue with the following quote from the 
python-dev thead:

> doing some sys.modules acrobatics and re-importing suddenly
changes the internal state of a previously imported [_csv] module.

The issue is now solved; both reproducers from that thread pass.

If you're interested, please read PEP 630 for a general overview of where we're 
at w.r.t. C-API changes that started with PEP 3121.
For the API used to fix this issue, see PEP 573; for the specific fix in _csv, 
see GH-23224.

Thanks to everyone involved, and especially to Nick Coghlan for helping me 
start this journey way back in 2013 :)

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



[issue42639] Make atexit state per interpreter

2020-12-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22637
pull_request: https://github.com/python/cpython/pull/23779

___
Python tracker 

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



[issue42639] Make atexit state per interpreter

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f7049b5fb680c774e4950d10be62859a749f4e79 by Victor Stinner in 
branch 'master':
bpo-42639: Add script_helper.run_test_script() (GH-23777)
https://github.com/python/cpython/commit/f7049b5fb680c774e4950d10be62859a749f4e79


--

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-15 Thread STINNER Victor

STINNER Victor  added the comment:

My PR 23778 fix the encoding/error handler when writing the filename into 
stderr, when the file does not exist:

$ LANG= PYTHONCOERCECLOCALE=0 ./python -X utf8=0 héllo.py
./python: can't open file '/home/vstinner/python/master/h\udcc3\udca9llo.py': 
[Errno 2] No such file or directory

--

___
Python tracker 

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



[issue42111] Make the xxlimited module an example of best extension module practices

2020-12-15 Thread Petr Viktorin


Change by Petr Viktorin :


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



[issue40600] Add option to disallow > 1 instance of an extension module

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

> Thanks! Indeed, that's an even better solution than I had in mind.
> It follows PEP 630 quite nicely: 
> https://www.python.org/dev/peps/pep-0630/#managing-global-state

The atexit module was my main motivation for this issue. So I'm fine with 
closing it.

--

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22636
pull_request: https://github.com/python/cpython/pull/23778

___
Python tracker 

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



[issue42644] logging.disable('WARN') breaks AsyncIO

2020-12-15 Thread Xavier Morel


Xavier Morel  added the comment:

The problem seems to be in the user code? As you were told by "Carreau", 
loggin.disable takes a logging level (an integer), since you're giving it a 
string which it dutifully stores, it blows up at the next logging call which 
happens to be in asyncio.

This is not an asyncio bug, nor is it a crash anymore than passing a broken key 
function to `sorted` is a *Python* crash.

At most it's an enancement request: `logging.disable` could raise a TypeError 
immediately or convert the value to a loglevel the way `setLevel` does instead 
of storing the broken value as-is (all it does currently is store the value it 
receives on the root logger without any check).

--
nosy: +xmorel

___
Python tracker 

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



[issue14935] PEP 384 Refactoring applied to _csv module

2020-12-15 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 6a02b384751dbc13979efc1185f0a7c1670dc349 by Petr Viktorin in 
branch 'master':
bpo-14935: Remove static state from the _csv module (GH-23224)
https://github.com/python/cpython/commit/6a02b384751dbc13979efc1185f0a7c1670dc349


--

___
Python tracker 

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



[issue42639] Make atexit state per interpreter

2020-12-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22635
pull_request: https://github.com/python/cpython/pull/23777

___
Python tracker 

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



[issue42639] Make atexit state per interpreter

2020-12-15 Thread hai shi


Change by hai shi :


--
pull_requests: +22634
pull_request: https://github.com/python/cpython/pull/23683

___
Python tracker 

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



[issue42639] Make atexit state per interpreter

2020-12-15 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10
nosy_count: 2.0 -> 3.0
pull_requests: +22633
pull_request: https://github.com/python/cpython/pull/23699

___
Python tracker 

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



[issue40600] Add option to disallow > 1 instance of an extension module

2020-12-15 Thread Petr Viktorin


Petr Viktorin  added the comment:

Thanks! Indeed, that's an even better solution than I had in mind.
It follows PEP 630 quite nicely: 
https://www.python.org/dev/peps/pep-0630/#managing-global-state

I will close this issue and PRs.
I don't agree with adding a general API for disallowing multiple modules, but 
do let me know if you see a need for it again.

--
resolution:  -> not a bug
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



[issue42647] Unable to use concurrent.futures in atexit hook

2020-12-15 Thread Julien Danjou


New submission from Julien Danjou :

Python 3.9 introduced a regression with concurrent.futures. The following 
program works fine on Python < 3.8 but raises an error on 3.9:

```
import atexit
import concurrent.futures

def spawn():
with concurrent.futures.ThreadPoolExecutor() as t:
pass

atexit.register(spawn)
```

```
$ python3.9 rep.py
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "", line 1007, in _find_and_load
  File "", line 986, in _find_and_load_unlocked
  File "", line 680, in _load_unlocked
  File "", line 790, in exec_module
  File "", line 228, in _call_with_frames_removed
  File 
"/usr/local/Cellar/python@3.9/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py",
 line 37, in 
threading._register_atexit(_python_exit)
  File 
"/usr/local/Cellar/python@3.9/3.9.0_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py",
 line 1370, in _register_atexit
raise RuntimeError("can't register atexit after shutdown")
RuntimeError: can't register atexit after shutdown
```

--
messages: 383058
nosy: jd
priority: normal
severity: normal
status: open
title: Unable to use concurrent.futures in atexit hook
type: crash
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



[issue35083] Fix documentation for __instancecheck__

2020-12-15 Thread M. Eric Irrgang


M. Eric Irrgang  added the comment:

Actually, it looks like performance concerns were raised as issues 
[2303](https://bugs.python.org/issue2303) and 
[2534](https://bugs.python.org/issue2534). For #2534, the issue was different.

For issue #2303, behavior-changing optimization was proposed. The first comment 
describes the cost of requiring a check to whether `__instancecheck__` is 
present (though I don't see what the comment refers to in 
1b7f891f416830d0c46ca1c9e1bfe62f05cda655, which is the commit containing the 
cited r58099, as best I can tell). However, the discussion may have ended 
prematurely when the optimization https://bugs.python.org/file9742/isinst.diff 
slipped in through a different change.

See https://bugs.python.org/issue2303 for discussion.

For what it's worth, Guido (author of PEP 3119) did not seem to object to 
https://codereview.appspot.com/504/diff/1/Objects/abstract.c and no one seems 
to have discussed the apparent inconsistency with PEP 3119.

--

___
Python tracker 

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



[issue42644] logging.disable('WARN') breaks AsyncIO

2020-12-15 Thread OverLordGoldDragon


OverLordGoldDragon  added the comment:

Everything's in the linked issue; in summary, the command kills IPython, and an 
IPython maintainer showed code suggesting the problem's rooted in CPython's 
improper handling of 'WARN' as alias for logging.WARN.

--

___
Python tracker 

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



[issue42639] Make atexit state per interpreter

2020-12-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b8fa135908d294b350cdad04e2f512327a538dee by Victor Stinner in 
branch 'master':
bpo-42639: Move atexit state to PyInterpreterState (GH-23763)
https://github.com/python/cpython/commit/b8fa135908d294b350cdad04e2f512327a538dee


--

___
Python tracker 

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



[issue42116] Inspect library ignore comments at the end of a function (inspect.getsource)

2020-12-15 Thread Irit Katriel


Irit Katriel  added the comment:

Thanks for the report. 3.6 is no longer maintained and 3.7 is getting security 
fixes only. So this won't be backported to those versions.

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



[issue42644] logging.disable('WARN') breaks AsyncIO

2020-12-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Reporting what? Please elaborate.

--

___
Python tracker 

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



[issue42646] Add function that supports "applying" methods

2020-12-15 Thread wyz23x2


wyz23x2  added the comment:

Edit: applied should be the better name because of reversed(), sorted() etc. 
and doesn't conflict with Py 2.

--

___
Python tracker 

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



[issue42115] Caching infrastructure for the evaluation loop: specialised opcodes

2020-12-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> pidigits and regex_v8 are LOAD_ATTR heavy benchmarks?

The PR is for LOAD_METHOD infrastructure, not for LOAD_ATTR (There was an 
incorrect title in the PR that I corrected but the contents are correct).

> I will run benchmarks in my machine to confirm the results.

Thanks a lot, Inada-san

--

___
Python tracker 

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



[issue42646] Add function that supports "applying" methods

2020-12-15 Thread wyz23x2


New submission from wyz23x2 :

Doing this is generally very annoying:
y = x.copy()
y.some_method()
Sometimes x doesn't have copy(), so:
from copy import deepcopy
y = deepcopy(x)
y.some_method()

So maybe a function could be added to help.
For example:

def apply(obj, function, /, args=(), kwargs={}):
try:
new = obj.copy()
except AttributeError:
from copy import copy
new = copy(obj)
function(new, *args, **kwargs)
return new
# implement reversed() for list
lis = [1, 2, 3, 4, 5]
arr = apply(lis, list.reverse)
print(arr)  # [5, 4, 3, 2, 1]

apply() maybe isn't the best name because of the builtin apply() in Python 2, 
but that's EOL. It could be added in the standard library.

--
components: Library (Lib)
messages: 383050
nosy: wyz23x2
priority: normal
severity: normal
status: open
title: Add function that supports "applying" methods
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



[issue42042] sphinx3 renders diffrently docs.python.org for 3.10

2020-12-15 Thread Wendy Reynolds


Change by Wendy Reynolds :


--
type:  -> performance
Added file: https://bugs.python.org/file49682/python-391.html

___
Python tracker 

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



[issue42577] Unhelpful syntax error when expression spans multiple lines

2020-12-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I concur, handling also multi-line constructs is tricky and I would prefer not 
to implement some hack for specific situations because my experience is that 
balancing that with other things Is tricky. As Lysandros mentioned, the parser 
reports correctly the location of the error as indentation is non important 
inside parentheses and the code there could be an expression or the begging of 
a generator.

On the other hand we could think if we have a way of detecting of a syntax 
error occurs in the context of an unclosed parentheses and maybe do something 
about it, but I have no idea still how many false negatives could appear.

--

___
Python tracker 

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



[issue33610] IDLE: Make multiple improvements to CodeContext

2020-12-15 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 99d37a0ee82c16f30a874c9b583d59a3844dc9c9 by Miss Islington (bot) 
in branch '3.9':
bpo-33610: Edit idlelib.codecontext (GH-23773) (GH-23775)
https://github.com/python/cpython/commit/99d37a0ee82c16f30a874c9b583d59a3844dc9c9


--

___
Python tracker 

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



[issue42116] Inspect library ignore comments at the end of a function (inspect.getsource)

2020-12-15 Thread nhamid


nhamid  added the comment:

thank you for the fix, I forgot to mention that python 3.6 and python 3.7 have 
this issue too.

--
versions: +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



[issue35083] Fix documentation for __instancecheck__

2020-12-15 Thread M. Eric Irrgang


M. Eric Irrgang  added the comment:

The optimization appears to have been made without this level of discussion. 
The change to PEP 3119 was likely overlooked. The intended PEP 3119 behavior 
seems clear and reasonable.

r61575 was a small part of the SVN merge that became git commit 
d5e2b6f3bcef9fea744bef331ad7278052223f11

Suggest reverting the `/* Quick test for an exact match */`.

If either the optimization is important, or the documented PEP 3119 behavior 
should be revised, suggest re-raising the issue as a proposed revision to PEP 
3119.

--

___
Python tracker 

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



[issue24416] Have date.isocalendar() return a structseq instance

2020-12-15 Thread Baptiste Mispelon


Baptiste Mispelon  added the comment:

(Apologies if this isn't the right place and/or time for this kind of negative 
feedback. I'm open to suggestions for a more appropriate venue)

I found it disheartening that my work on this ticket has been erased.

While I understand that other contributors have worked a lot more on this than 
I have, I did put in a non-negligible amount of work into this ticket.
>From creating the original issue to taking a first stab at writing a patch 
>(including several rounds of back and forth with core developers).

It would have been nice to have been credited in the commit message for example.

As-is, it gives me the impression that the only things this project values are 
pure code contributions.

I couldn't find documentation about how this projects credits contributors.
If it's standard practice not to credit non-code contributions or non-merged 
code contributions then I humbly suggest you reconsider this practice.
>From my perspective it really discourages me from making further contributions.

--

___
Python tracker 

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



  1   2   >