[issue36319] Erro 0xC0000374 on windows 10

2021-03-26 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> [Windows] time: crash on formatting time with de_DE locale

___
Python tracker 

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



[issue36792] [Windows] time: crash on formatting time with de_DE locale

2021-03-26 Thread Eryk Sun


Eryk Sun  added the comment:

ucrt in Windows 10 v2004 uses an internal wide-character version of the 
time-zone name, which gets updated by _tzset() and kept in sync with the 
_tzname encoded strings. Also, note that the current implementation uses the 
locale's ANSI code page for both "de-DE" and "de_DE". UTF-8 has to be requested 
explicitly when using a BCP-47 locale name, such as "de_DE.UTF-8" or 
"de-DE.UTF-8", and UTF-8 is the only explicit codeset that's allowed in this 
case.

--
resolution:  -> third party
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



[issue36792] [Windows] time: crash on formatting time with de_DE locale

2021-03-26 Thread Eryk Sun


Change by Eryk Sun :


--
Removed message: https://bugs.python.org/msg361476

___
Python tracker 

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



[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-03-26 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> [Windows] OSError when testing whether pathlib.Path('*') exists

___
Python tracker 

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



[issue35306] [Windows] OSError when testing whether pathlib.Path('*') exists

2021-03-26 Thread Eryk Sun


Change by Eryk Sun :


--
title: OSError [WinError 123] when testing if pathlib.Path('*') (asterisks) 
exists -> [Windows] OSError when testing whether pathlib.Path('*') exists
type:  -> behavior
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



[issue35306] OSError [WinError 123] when testing if pathlib.Path('*') (asterisks) exists

2021-03-26 Thread Eryk Sun


Change by Eryk Sun :


--
Removed message: https://bugs.python.org/msg333746

___
Python tracker 

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



[issue41661] os.path.relpath does not document ValueError on Windows with different drives

2021-03-26 Thread Eryk Sun


Eryk Sun  added the comment:

The suggested documentation change looks good to me.

--
type: behavior -> enhancement
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.7

___
Python tracker 

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



[issue34142] Windows launcher version lookup flawed

2021-03-26 Thread Eryk Sun


Change by Eryk Sun :


--
type: behavior -> enhancement
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



[issue37769] Windows Store installer should warn user about MAX_PATH

2021-03-26 Thread Eryk Sun


Change by Eryk Sun :


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



[issue38999] Python launcher on Windows does not detect active venv

2021-03-26 Thread Eryk Sun


Eryk Sun  added the comment:

> I realize one could interpret the python3 in the shebang as an 
> "explicit version specification", but a) that's not on the 
> command line, which seems the more natural reading and b) it's 
> only a partial specification, since it doesn't say which python3
> to use.

The wanted version is specified by the command line, else by the script 
shebang. The default version to use for `py -3` or a "python3" virtual command 
in a shebang (e.g. "#!/usr/bin/python3") is determined by the PY_PYTHON3 
environment variable or the "python3" setting in "py.ini". If a default 3.x 
version isn't configured, the launcher uses the latest-version installation of 
3.x, of which the 64-bit version is preferred (e.g. 3.10 is preferred over 
3.10-32, which is preferred over 3.9).

For just `py` or a "python" virtual command in a shebang -- i.e. when no 
version is specified -- an active virtual environment is preferred. Else it 
uses the default that's set in PY_PYTHON environment variable or the "python" 
setting in py.ini. If no default is set, and there's no shebang, the launcher 
prefers the latest-version 3.x that's installed. If there's a shebang, the 
launcher prefers the latest-version 2.x that's installed.

Originally, the non-versioned "/usr/bin/env python" virtual command was handled 
the same as all other non-versioned "python" virtual commands. But later on the 
"env" form was changed to first try a path search for "python.exe" via WinAPI 
SearchPathW() before falling back on the common behavior. In most cases this 
search will find an active virtual environment. But it could be that another 
directory with "python.exe" is added to the front of PATH after a virtual 
environment is activated.

---

How about generalizing "/usr/bin/env python*" to support virtual environments 
by getting the "version" (venv) or "version_info" (virtualenv) value from 
"%VIRTUAL_ENV%\pyvenv.cfg"? I'd prefer to get that value in 
locate_venv_python(). It can still set the `version` string to "venv", but 
extend the INSTALLED_PYTHON record with a `venv_version` string that can be 
checked in the result of find_python_by_version(L"venv").

Extend locate_python() with a `search` parameter. If `search` is true, then do 
a path search [1] for `wanted_ver`, with the searched "python*.exe" executable 
name set depending on the launcher build (i.e. py[w][_d].exe). If searching is 
skipped or doesn't find a match, then run an active virtual environment if 
either `wanted_ver` is empty or `search` is true and `wanted_ver` is compatible 
with the virtual environment. Otherwise locate a registered Python installation 
based on `wanted_ver` and `from_shebang`.

---

For GUI and debug builds, the PYTHON_EXECUTABLE macro could be split into a 
base "python[w]" name and an extension "[_d].exe" name, which makes it easy to 
construct the name to search for given a valid version string. For example, 
with a pyw_d.exe debug build, "python3" would be searched for as 
"pythonw3_d.exe".

---

[1] I'd prefer to expand the path search to also check the user and machine 
"App Paths", which are like "$HOME/.local/bin" and "/usr/bin" for the Windows 
shell.

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 11b85abbae8aaa8410b19f358abd7b401881bb1c by Pablo Galindo in 
branch 'master':
bpo-43636: Validate the version tag in _PyType_Lookup (GH-25032)
https://github.com/python/cpython/commit/11b85abbae8aaa8410b19f358abd7b401881bb1c


--

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Yup, that makes sense. Let me update the PR

--

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Dino Viehland


Dino Viehland  added the comment:

I think the issue here is that in assign_version_tag there's this code:

if (type->tp_version_tag == 0) {
// Wrap-around or just starting Python - clear the whole cache
type_cache_clear(cache, 1);
return 1;
}

the return 1 is incorrect, it should be return 0 as a valid version tag hasn't 
been assigned.

--

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I think I have it, we still neet to validate that the version tag is correct. 
Can you take a look at https://github.com/python/cpython/pull/25032 ?

--
stage: patch review -> 

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Dino Viehland


Dino Viehland  added the comment:

And it looks like we have an entry with a 0 version, but with a valid name:

(type_cache_entry) $3 = {
  version = 0
  name = 0x000100ec44f0
  value = NULL
}

--

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Dino Viehland


Dino Viehland  added the comment:

It's probably worth having an assert that the version tag is valid, that'll 
make it easier to see what's going wrong in the cache hit case.  We should have 
the version tag being 0 now when it's not valid.  I may not be able to debug it 
anymore tonight, but if no will look tomorrow.

--

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Seems that the problem is removing the check:

if (MCACHE_CACHEABLE_NAME(name) &&
_PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG)) {

--

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Dino Viehland


Dino Viehland  added the comment:

Looking!

--

___
Python tracker 

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



[issue43576] python3.6.4 os.environ error when write chinese to file

2021-03-26 Thread Eryk Sun

Eryk Sun  added the comment:

> If you are lost with locale encodings, you can attempt to encode
> everything in UTF-8 and enables the Python UTF-8 Mode:

rushant is using Python 3.6. UTF-8 mode was added in 3.7, so it's not an option 
without first upgrading to 3.7. Also, it's important to note that the 
suggestion to "attempt to encode everything in UTF-8" includes whatever 
terminal encoding or shell-script file encoding is used for `export a="中文"`. If 
it's not using UTF-8, then setting the preferred encoding in Python to UTF-8 
isn't going to help.

--

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +methane

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Dino, could you take a look?

--

___
Python tracker 

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



[issue43452] Microoptimize PyType_Lookup for cache hits

2021-03-26 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Seems that commit ee48c7d54147ae906776b9f6f96e8920e097d0c4  has introduced a 
regression:

https://bugs.python.org/issue43636

--

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Bisecting points at:

commit ee48c7d54147ae906776b9f6f96e8920e097d0c4
Author: Dino Viehland 
Date:   Sat Mar 20 12:12:05 2021 -0700

bpo-43452: Micro-optimizations to PyType_Lookup (GH-24804)

The common case going through _PyType_Lookup is to have a cache hit. There 
are some small tweaks that can make this a little cheaper:

* The name field identity is used for a cache hit and is kept alive by the 
cache. So there's no need to read the hash code o the name - instead, the 
address can be used as the hash.

*  There's no need to check if the name is cachable on the lookup either, 
it probably is, and if it is, it'll be in the cache.

*  If we clear the version tag when invalidating a type then we don't 
actually need to check for a valid version tag bit.

--
nosy: +dino.viehland

___
Python tracker 

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



[issue43636] test_descr fails randomly when executed with -R :

2021-03-26 Thread Pablo Galindo Salgado

New submission from Pablo Galindo Salgado :

❯ ./python -m test test_descr -m test_slots -R 3:3
0:00:00 load avg: 0.26 Run tests sequentially
0:00:00 load avg: 0.26 [1/1] test_descr
beginning 6 repetitions
123456
test test_descr failed -- Traceback (most recent call last):
  File "/home/pablogsal/github/cpython/Lib/test/test_descr.py", line 1201, in 
test_slots
c.abc = 5
AttributeError: 'C' object has no attribute 'abc'

test_descr failed

== Tests result: FAILURE ==

1 test failed:
test_descr

Total duration: 72 ms
Tests result: FAILURE

--
components: Tests
messages: 389575
nosy: pablogsal, vstinner
priority: normal
severity: normal
status: open
title: test_descr fails randomly when executed with -R :
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



[issue43624] Add underscore as a decimal separator for string formatting

2021-03-26 Thread Terry Davis


Terry Davis  added the comment:

Good point Victor, though I wonder how likely it is that a person using 3.10 
would only use this particular new feature, and have an otherwise 
backwards-compatible codebase.

This isn't something that I asked about out of necessity, and there hasn't been 
any other discussion of this idea that anyone can remember.

On the other hand, I suppose it would be possible to have a feature flag that 
can be used to disable decimal underscores in 3.10 to prevent test failures. 
Just spitballing...

--

___
Python tracker 

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



[issue43594] Subclass of both `ABC` and `ABCMeta` breaks on `__subclasscheck__`

2021-03-26 Thread Guido van Rossum


Guido van Rossum  added the comment:

I think it's strange code -- the mixin wants to be a metaclass but also an ABC 
(which is not a meta class). Unless there's a serious use case I'm inclinded to 
reply "don't care".

--

___
Python tracker 

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



[issue43576] python3.6.4 os.environ error when write chinese to file

2021-03-26 Thread STINNER Victor


STINNER Victor  added the comment:

Oh, I forgot to note that Windows is not affected by this issue, since Windows 
provides directly environment variables as Unicode, and so Python doesn't need 
to decode byte strings to read os.environ['a'] ;-)

--

___
Python tracker 

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



[issue43576] python3.6.4 os.environ error when write chinese to file

2021-03-26 Thread STINNER Victor


STINNER Victor  added the comment:

Python works as expected: the UTF-8 codec doesn't allow to encode surrogate 
characters.

Surrogate characters are coming from os.environ['a'] because this environment 
variable contains bytes which cannot be decoded from the 
sys.getfilesystemencoding().

You should fix your system setup, especially the locale encoding. The strings 
stored in the "a" environment variable was not encoded to the Python filesystem 
encoding:
https://docs.python.org/dev/glossary.html#term-filesystem-encoding-and-error-handler

If you are lost with locale encodings, you can attempt to encode everything in 
UTF-8 and enables the Python UTF-8 Mode:
https://docs.python.org/dev/library/os.html#python-utf-8-mode

Good luck with your setup ;-)

Hint: use print(ascii(job_name)) to dump the string content.

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



[issue43354] xmlrpc.client: Fault.faultCode erroneously documented to be a string, should be int

2021-03-26 Thread miss-islington

miss-islington  added the comment:


New changeset 027b6699276ed8d9f68425697ac89bf61e54e6b9 by Jürgen Gmach in 
branch 'master':
bpo-43354: xmlrpc: Fix type documentation for Fault.faultCode (GH-24707)
https://github.com/python/cpython/commit/027b6699276ed8d9f68425697ac89bf61e54e6b9


--
nosy: +miss-islington

___
Python tracker 

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



[issue43605] Eval/exec and comprehension scopes unclear in documentation

2021-03-26 Thread Bruno Loff


Bruno Loff  added the comment:

Hmm... OK, if I understand correctly, the evaluation procedure for a (e.g.) 
list comprehension, as described in the documentation you linked in, is as 
follows:

* The generator in the leftmost for expression is evaluated in the current 
local scope. (doc: "The iterable expression in the leftmost for clause is 
evaluated directly in the enclosing scope and then passed as an argument to the 
implicitly nested scope.")
* A new nested scope is created, and the iterator object is passed to that new 
scope as an argument.
* The other for and if clauses are evaluated in the new scope.

As you mention, the documentation does not properly describe in which scope is 
evaluated the leftmost expression that generates each object (to be placed in 
the list).

You say that the leftmost expression is also not evaluated in the enclosing 
scope (which I take means that it is being evaluated in the new nested scope). 
But notice that sometimes it *seems to be*.

There are two inconsistent behaviors:

1) If evaluated outside of an eval, using local objects works just fine. It is 
then reasonable to assume that the leftmost expression has access to the 
locals() of the function it is in. (see the line with the comment `# works as 
expected` in the first post I made).

2) If evaluated inside an eval the leftmost expression cannot access the locals 
(see the example I gave). This happens even when locals() is passed to the 
__locals argument of the call to `eval`.

It seems reasonable that behavior (1) should happen in both cases. In fact, I 
think it is *very* reasonable to expect that calling eval() on a string should 
have the exact same effect as if the code that is inside the eval had been 
written as part of the source code. Don't you think? I believe that this is 
exactly what happens, e.g., in Lisp.

I would guess this is just a bug, but maybe there is some technical reason why 
this is not possible. If that is (sadly) the case, this should be explained in 
the documentation.

Currently I don't really have a mental model for what happens when I call 
`eval`.

--

___
Python tracker 

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



[issue43576] python3.6.4 os.environ error when write chinese to file

2021-03-26 Thread Eryk Sun

Eryk Sun  added the comment:

I think this is a locale configuration problem, in which the locale encoding 
doesn't match the terminal encoding. If so, it can be closed as not a bug.

> export a="中文"

In POSIX, the shell reads "中文" from the terminal as bytes encoded in the 
terminal encoding, which could be UTF-8 or some legacy encoding. The value of 
`a` is set directly as this encoded text. There is no intermediate 
decode/encode stage in the shell. For a child process that decodes the value of 
the environment variable, as Python does, the locale's LC_CTYPE encoding should 
be the same or compatible with the terminal encoding.

> job_name = os.environ['a']
> print(job_name)

In POSIX, sys.stdout.errors, as used by print(), will be "surrogateescape" if 
the default LC_CTYPE locale is a legacy locale -- which in 3.6 is the case for 
the "C" locale, since it's usually limited to 7-bit ASCII. "surrogateescape" is 
also the errors handler for decoding bytes os.environb (POSIX) as text 
os.environ. When decoding, "surrogateescape" handles non-ASCII byte values that 
can't be decoded by translating the value into the reserved surrogate range 
U+DC80 - U+DCFF. When encoding, it translates each surrogate code back to the 
original byte value in the range 0x80 - 0xFF. 

Given the above setup, byte sequences in os.environb that can't be decoded with 
the default LC_CTYPE locale encoding will be surrogate escaped in the decoded 
text  The surrogate-escaped values roundtrip back to bytes when printed, 
presumably as the terminal encoding.

> with open('name.txt', 'w', encoding='utf-8')as fw:
>fw.write(job_name)

The default errors handler for open() is "strict" instead of "surrogateescape", 
so the surrogate-escaped values in job_name cause the encoding to fail.

> Your code runs for me on Windows

In Windows, Python uses the wide-character (16-bit wchar_t) environment of the 
process for os.environ, and, in 3.6+, it uses the console session's 
wide-character API for console files such as sys.std* when they aren't 
redirected to a pipe or disk file. Conventionally, wide-character strings 
should be valid UTF-16LE text. So getting "中文" from os.environ and printing it 
should 'just work'. The output will even be displayed correctly if the console 
session uses a font that supports "中文", or if it's a pseudoconsole (conpty) 
session that's attached to a terminal that supports automatic font fallback, 
such as Windows Terminal.

--
components: +IO, Interpreter Core, Library (Lib), Unicode -C API
nosy: +eryksun, ezio.melotti, vstinner

___
Python tracker 

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



[issue43620] os.path.join does not use os.sep as documentation claims

2021-03-26 Thread Fred Drake


Fred Drake  added the comment:

PR applied and backported; closing this.

Thanks, Jared!

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



[issue43606] tkinter: initial huge window & no widgets visible

2021-03-26 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy:  -paul.moore, steve.dower, tim.golden, zach.ware
title: PySimpleGUI: initial huge window & no widgets visible -> tkinter: 
initial huge window & no widgets visible

___
Python tracker 

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



[issue43620] os.path.join does not use os.sep as documentation claims

2021-03-26 Thread Fred Drake


Fred Drake  added the comment:


New changeset 455583b54aaec9a4266ff37dd438cbbd8ec6068a by Miss Islington (bot) 
in branch '3.8':
bpo-43620: Remove reference to os.sep from os.path.join() doc (GH-25025, 
GH-5030)
https://github.com/python/cpython/commit/455583b54aaec9a4266ff37dd438cbbd8ec6068a


--

___
Python tracker 

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



[issue43605] Eval/exec and comprehension scopes unclear in documentation

2021-03-26 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

This is not an execution bug.

https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries

"However, aside from the iterable expression in the leftmost for clause, the 
comprehension is executed in a separate implicitly nested scope. This ensures 
that names assigned to in the target list don’t “leak” into the enclosing 
scope."

So when the passed in locals is not the passed in globals, that means a 
separate local scope.

https://docs.python.org/3/reference/expressions.html#generator-expressions is a 
little less clear.

"Variables used in the generator expression are evaluated lazily when the 
__next__() method is called for the generator object (in the same fashion as 
normal generators). However, the iterable expression in the leftmost for clause 
is immediately evaluated, so that an error produced by it will be emitted at 
the point where the generator expression is defined, rather than at the point 
where the first value is retrieved. Subsequent for clauses and any filter 
condition in the leftmost for clause cannot be evaluated in the enclosing scope 
as they may depend on the values obtained from the leftmost iterable."

By implication, the value expressions are also not evaluated in the enclosing 
local scope.

I am thinking about adding something to the eval/exec doc, but this issue 
overlaps with another one about their doc.





https://docs.python.org/3/reference/expressions.html#generator-expressions

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, terry.reedy
stage:  -> needs patch
title: Issue of scopes unclear in documentation, or wrongly implemented -> 
Eval/exec and comprehension scopes unclear in documentation
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



[issue43620] os.path.join does not use os.sep as documentation claims

2021-03-26 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue43635] Documentation needs to declare CalledProcessError as potentially resulting from subprocess.run()

2021-03-26 Thread Jennie


New submission from Jennie :

The documentation for subprocess says that run() can return 
CalledProcessError...

https://docs.python.org/3/library/subprocess.html#subprocess.run

...but when you click on the link (5th paragraph down) for CalledProcessError, 
it only lists check_call() and check_output() as methods that can return it.

My understanding is that check_call(), at least, is (becoming?) deprecated. So 
this section should definitely mention run():

https://docs.python.org/3/library/subprocess.html#subprocess.CalledProcessError

--
assignee: docs@python
components: Documentation
messages: 389564
nosy: docs@python, jennievh
priority: normal
severity: normal
status: open
title: Documentation needs to declare CalledProcessError as potentially 
resulting from subprocess.run()
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



[issue39616] SSLContext.check_hostname description is inaccurate wrt match_hostname

2021-03-26 Thread Irit Katriel


Change by Irit Katriel :


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



[issue39369] Doc: Update mmap readline method documentation

2021-03-26 Thread Irit Katriel


Change by Irit Katriel :


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



[issue43585] perf_counter() returns computers uptime

2021-03-26 Thread Eryk Sun


Eryk Sun  added the comment:

I think so. But I'll mark it pending for now in case Tobi provides more 
information to explain why this is a problem. Making time.perf_counter() 
system-wide in Windows was fixing it to match the documented behavior. That 
this provides the system uptime is a natural consequence of how the system 
performance counter is implemented consistently for all processes for the 
entire uptime of the system.

--
status: open -> pending
type:  -> behavior

___
Python tracker 

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



[issue43594] Subclass of both `ABC` and `ABCMeta` breaks on `__subclasscheck__`

2021-03-26 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Verified on Win10 for 3.8-3.10.  3.6 only gets security fixes.

Guido, is the above a bug?  (There is no listed abc or 'metaclass' expert and I 
don't know.)

--
nosy: +gvanrossum, terry.reedy
title: A metaclass that inherits both `ABC`  and `ABCMeta` breaks on 
`__subclasscheck__` -> Subclass of  both `ABC`  and `ABCMeta` breaks on 
`__subclasscheck__`
versions: +Python 3.10, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue43585] perf_counter() returns computers uptime

2021-03-26 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Eryk, if I understand correctly, this should be closed as 'not a bug'.  Correct?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue39231] Mistaken notion in tutorial

2021-03-26 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
nosy: +iritkatriel
nosy_count: 4.0 -> 5.0
pull_requests: +23778
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25029

___
Python tracker 

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



[issue43576] python3.6.4 os.environ error when write chinese to file

2021-03-26 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

3.6 only gets security patches.  You or someone needs to show an unfixed bug in 
master.  Your code runs for me on Windows, whereas you appear to be using *nix. 
 Replacing job_name.encode() should have the same behavior.  Do you see the 
same with job_name="中文" at the top instead?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue43609] ast.unparse-ing a FunctionType gives ambiguous result

2021-03-26 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> @BTaskaya I've seen this in third party ides and type checker. For example 
> they are referring to "Union[Callable[[], Union[int, str]], None]" as "() -> 
> (int | str) | None" where there are parentheses around the returns.

Though you can not simple parse this and expect to get the AST you gave as an 
example (fun2). This would be parsed like
FunctionType(
argtypes=[],
returns=BinOp(
left=BinOp(
left=Name(id='int', ctx=Load()),
op=BitOr(),
right=Name(id='str', ctx=Load())),
op=BitOr(),
right=Constant(value=None)))

and we would roundtrip it;
>>> source = '() -> (int | str) | None'
>>> ast1 = ast.parse(source, mode='func_type')
>>> ast2 = ast.parse(ast.unparse(ast1), mode='func_type')
>>> ast.dump(ast1) == ast.dump(ast2)
True


I get what you mean (like 2 separate nodes connected with Union[]) though you 
can not simply parse the func_type syntax ( () -> ... ) with the normal parser, 
so you can't use it with binary or. It seems like this is not a bug on ourside, 
but rather a bug on the creator of this source (like union of func type and 
binary or).

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



[issue42136] [importlib] deprecate module_repr() methods

2021-03-26 Thread Brett Cannon


Change by Brett Cannon :


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



[issue43634] Extensions build does not respect --jobs setting

2021-03-26 Thread JustAnotherArchivist


New submission from JustAnotherArchivist :

The extension building does not respect the --jobs option passed to make. 
Specifically, in that step, `python setup.py build` always spawns as many gcc 
processes as there are CPU cores available regardless of that option. This 
caused problems for me because I have a VM that sees all host machine CPU cores 
but only has a limited amount of RAM. Despite running `make -j 4`, many more 
gcc processes are spawned, and this immediately causes memory starvation and a 
system freeze after a few seconds.

The reason for this is that setup.py blindly enables parallelism in the 
extension compilation if '-j' appears in the MAKEFLAGS at 3.9.2/setup.py:355. 
Later on, distutils uses os.cpu_count to set the worker count, i.e. the '-j' 
*value* is ignored. This behaviour was first introduced with #5309 as far as I 
can see, though I haven't tested anything other than version 3.9.2.

Hacky workaround: patching the above setup.py line to `self.parallel = 4`.

Cf. https://github.com/pyenv/pyenv/issues/1857

--
components: Build
messages: 389558
nosy: JustAnotherArchivist
priority: normal
severity: normal
status: open
title: Extensions build does not respect --jobs setting
type: resource usage
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



[issue42136] [importlib] deprecate module_repr() methods

2021-03-26 Thread Brett Cannon


Brett Cannon  added the comment:


New changeset 1899087b21119c5c64cd41619b542c0bf0ab5751 by Brett Cannon in 
branch 'master':
bpo-42136: Deprecate module_repr() as found in importlib (GH-25022)
https://github.com/python/cpython/commit/1899087b21119c5c64cd41619b542c0bf0ab5751


--

___
Python tracker 

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



[issue43568] Drop support for Mac OS X < 10.3 module linking

2021-03-26 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue43565] PyUnicode_KIND macro does not has specified return type

2021-03-26 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +benjamin.peterson, ezio.melotti, lemburg

___
Python tracker 

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



[issue43564] ftp tests in test_urllib2net should skip on unreachable network

2021-03-26 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: ftp tests in test_urllib2net fail instead of skipping on unreachable 
network -> ftp tests in test_urllib2net should skip on unreachable network

___
Python tracker 

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



[issue43564] ftp tests in test_urllib2net fail instead of skipping on unreachable network

2021-03-26 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +giampaolo.rodola, orsenthil

___
Python tracker 

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



[issue42136] [importlib] deprecate module_repr() methods

2021-03-26 Thread Brett Cannon


Change by Brett Cannon :


--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue43633] Improve the textual representation of IPv4-mapped IPv6 addresses

2021-03-26 Thread Maxime Mouchet

New submission from Maxime Mouchet :

Python supports IPv4-mapped IPv6 addresses as defined by RFC 4038:
 "the IPv6 address :::x.y.z.w represents the IPv4 address x.y.z.w.”

The current behavior is as follows:

   from ipaddress import ip_address
   addr = ip_address(':::8.8.4.4') # IPv6Address(':::808:404')
   addr.ipv4_mapped # IPv4Address('8.8.4.4')

Note that the textual representation of the IPv6Address is *not* in IPv4-mapped 
format.
It prints :::808:404 instead of :::8.8.4.4.
This is technically correct, but it’s somewhat frustrating as it makes it 
harder to read IPv4s embedded in IPv6 addresses.

My proposal would be to check, in __str__, if an IPv6 is an IPv4-mapped, and to 
return the appropriate representation :

   from ipaddress import ip_address
   addr = ip_address(':::8.8.4.4')

   # Current behavior
   str(addr)  # ':::808:404'
   repr(addr) # IPv6Address(':::808:404')

   # Proposed behavior
   str(addr)  # ':::8.8.4.4'
   repr(addr) # IPv6Address(':::8.8.4.4')

A few data points:
- Julia prints :::808:404 (current behavior)
- C (glibc) and ClickHouse prints :::8.8.4.4 (proposed behavior)

--
components: Library (Lib)
messages: 389556
nosy: maxmouchet
priority: normal
severity: normal
status: open
title: Improve the textual representation of IPv4-mapped IPv6 addresses
type: enhancement

___
Python tracker 

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



[issue43620] os.path.join does not use os.sep as documentation claims

2021-03-26 Thread Fred Drake


Fred Drake  added the comment:


New changeset f311290f091957653bba5ebfda28ad981bb78363 by Miss Islington (bot) 
in branch '3.9':
bpo-43620: Remove reference to os.sep from os.path.join() doc (GH-25025) 
(#25027)
https://github.com/python/cpython/commit/f311290f091957653bba5ebfda28ad981bb78363


--

___
Python tracker 

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



[issue43620] os.path.join does not use os.sep as documentation claims

2021-03-26 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue43620] os.path.join does not use os.sep as documentation claims

2021-03-26 Thread Fred Drake


Fred Drake  added the comment:


New changeset 21a2cabb3795f5170c746ab8f29e9d25c7442550 by Jared Sutton in 
branch 'master':
bpo-43620: Remove reference to os.sep from os.path.join() doc (#25025)
https://github.com/python/cpython/commit/21a2cabb3795f5170c746ab8f29e9d25c7442550


--

___
Python tracker 

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



[issue43632] an error in the documentation of descriptor

2021-03-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the report.

This has already been fixed for the 3.9 release and later:

https://docs.python.org/3.9/howto/descriptor.html#functions-and-methods

It was minor enough to not warrant a backport to 3.8.

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



[issue43632] an error in the documentation of descriptor

2021-03-26 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger
priority: normal -> 

___
Python tracker 

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



[issue41506] Inclusion or documentation of extended with syntax in 3.9

2021-03-26 Thread Irit Katriel


Change by Irit Katriel :


--
assignee:  -> docs@python
components: +Documentation, Interpreter Core
nosy: +docs@python

___
Python tracker 

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



[issue43094] sqlite3 signature discrepancies between documentation and implementation

2021-03-26 Thread Berker Peksag


Berker Peksag  added the comment:

> Berker, I started drafting a PEP. Would you be interested in helping?

Of course! I may be not be able to respond to you quickly in the next few 
weeks, though.

--

___
Python tracker 

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



[issue43620] os.path.join does not use os.sep as documentation claims

2021-03-26 Thread Jared Sutton


Jared Sutton  added the comment:

Thank you for understanding my position, Fred. I submitted a draft PR (25025) 
for this bug.

--

___
Python tracker 

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



[issue43620] os.path.join does not use os.sep as documentation claims

2021-03-26 Thread Jared Sutton


Change by Jared Sutton :


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

___
Python tracker 

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



[issue41906] logging.config.dictConfig does not work with callable filters

2021-03-26 Thread Mario Corchero


Mario Corchero  added the comment:

Vinay would you consider a patch for logging where dictConfig allows taking 
objects directly in addition to the reference id?

That would allow the following:

```

def noErrorLogs(param):
return 1 if param.levelno < 40 else 0

logconfig_dict = {
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "DEBUG",
"stream": "ext://sys.stdout",
"filters": [noErrorLogs]
}
},
"root": {"level": "DEBUG", "handlers": ["console"]},
"version": 1,
}
dictConfig(logconfig_dict)
```

or alternatively passing them on declaration:

```
logconfig_dict = {
'filters': {
'myfilter': noErrorLogs,
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "DEBUG",
"stream": "ext://sys.stdout",
"filters": ["myfilter"]
}
},
"root": {"level": "DEBUG", "handlers": ["console"]},
"version": 1,
}
dictConfig(logconfig_dict)
```

I'm happy to put a patch together if that looks good to you.

--
nosy: +mariocj89

___
Python tracker 

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



[issue12638] urllib.URLopener prematurely deletes files on cleanup

2021-03-26 Thread Irit Katriel


Irit Katriel  added the comment:

I think this is out of date as this feature was deprecated in issue10050.

--
components: +Library (Lib) -None
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



[issue43624] Add underscore as a decimal separator for string formatting

2021-03-26 Thread STINNER Victor


STINNER Victor  added the comment:

How backward incompatible and annoying would it be to modify the behavior of 
the existing "_f" format?

Do you see use cases which only want to group digits in the integer part but 
not the fractional part?

According to 
https://discuss.python.org/t/add-underscore-as-a-thousandths-separator-for-string-formatting/7407
 discussion, grouping digits was first designed for integers, and the 
fractional part of floats was simply ignored/forgotten. I mean, it doesn't 
sound like a deliberate choice to not group digits in the fractional part.

The advantage of changing "_f" format is to keep backward compatibility: Python 
3.9 and older would not group digits in the fractional part, but at least they 
don't fail with an error. If you write code with "_._f" format, you need a 
fallback code path for Python 3.9 and older:

if sys.version_info >= (3, 10):
   text = f"my {...} very {...} long {...} and {...} complex {...} format 
string: x={x:_._f}"
else:
   text = f"my {...} very {...} long {...} and {...} complex {...} format 
string: x={x:_f}"

Or:

text = f"my {...} very {...} long {...} and {...} complex {...} format string:" 
+ (f"x={x:_f}" if sys.version_info >= (3, 10) else "x={x:_f}")

Or many other variants.

The main drawback is the risk to break tests relying on the exact output.

About the separator character and the number of digits per group, IMO there is 
no standard working in all countries and all languages. But since we have a 
strict rule of 3 digits with "_" separator, I am fine with doing the same for 
the fractional part. It's an "arbitrary" choice, but at least, it's consistent.

People wanting a different format per locale/language should write their own 
function. Once enough people will agree on such API, we can consider to add it 
to the stdlib. But for now, IMO 3 digits with "_" is good enough.

By the way, I agree that it's hard to read numbers with many digits in the 
decimal part ;-)

>>> f"{1/7:_.30f}"
'0.142857142857142849212692681249'

>>> f"{10**10+1/7:_.10f}"
'10_000_000_000.1428565979'

--

___
Python tracker 

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



[issue43632] an error in the documentation of descriptor

2021-03-26 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



[issue43624] Add underscore as a decimal separator for string formatting

2021-03-26 Thread STINNER Victor


STINNER Victor  added the comment:

> If we do anything for float, we should do the same for decimal.Decimal.

and complex ;-)

--

___
Python tracker 

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



[issue43632] an error in the documentation of descriptor

2021-03-26 Thread 江杉

New submission from 江杉 <23533...@gmail.com>:

In this section 
 https://docs.python.org/3.8/howto/descriptor.html#functions-and-methods , 
there is an error:

the output of CMD 'd.f.__func__' should be same as the output of 
'D.__dict__['f']'. Here the former should be '', 
but not ''

--
assignee: docs@python
components: Documentation
messages: 389545
nosy: 2353381a, docs@python
priority: normal
severity: normal
status: open
title: an error in the documentation of descriptor
versions: Python 3.10, 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



[issue24132] Direct sub-classing of pathlib.Path

2021-03-26 Thread Irit Katriel


Change by Irit Katriel :


--
components: +Library (Lib)
stage: patch review -> needs patch
type: behavior -> enhancement
versions: +Python 3.10 -Python 3.6

___
Python tracker 

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



[issue43094] sqlite3 signature discrepancies between documentation and implementation

2021-03-26 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> I'd prefer writing a PEP and fix all modules once and for all.

Berker, I started drafting a PEP. Would you be interested in helping?

--

___
Python tracker 

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



[issue43626] SIGSEV in PyErr_SetObject

2021-03-26 Thread STINNER Victor


STINNER Victor  added the comment:

> That makes me think that this is a problem in pymongo module. I will report 
> this bug to them.

Yeah, in 90% of cases, the bug comes from a third party C extensions. That's 
why Python 3.10 now dumps the list of 3rd party C extensions on a fatal error 
:-)

https://twitter.com/VictorStinner/status/1374736944022876169

--

___
Python tracker 

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



[issue43626] SIGSEV in PyErr_SetObject

2021-03-26 Thread Abraham Macias


Abraham Macias  added the comment:

Thank you Victor for your response.
I follow your advice but the output was an error in a different point of the 
code and I couldn't see any information about memory allocations.

But, I compiled Python 3.7 from source and modified the "Python/errors.c" code 
where the problem is detected in the following way:

void
PyErr_SetObject(PyObject *exception, PyObject *value)
{
PyThreadState *tstate = PyThreadState_GET();
PyObject *exc_value;
PyObject *tb = NULL;
_PyErr_StackItem *exc_info = NULL;


if (exception != NULL &&
!PyExceptionClass_Check(exception)) {
PyErr_Format(PyExc_SystemError,
 "exception %R not a BaseException subclass",
 exception);
return;
}

Py_XINCREF(value);
exc_info = _PyErr_GetTopmostException(tstate);
exc_value = exc_info->exc_value;
if (exc_value != NULL && exc_value != Py_None) {
/* Implicit exception chaining */
printf("exc_value=%p\n", exc_value);
printf("exc_info=%p\n", exc_info);
printf("tstate=%p\n", tstate);
printf("traceback=%p\n", exc_info->exc_traceback);
printf("exc_value.ob_type=%p\n", exc_value->ob_type);
Py_INCREF(exc_value);
   
In this way I had the pointer printed just before the error happening:

exc_value=0x73726573756e69
exc_info=0x7f83bfafacb8
tstate=0x5605dcd41330
traceback=0x6b6f0100
Segmentation fault (core dumped)

And by using gdb I printed the memory contents:

(gdb) x/32c 0x7f83bfafacb8
0x7f83bfafacb8: 111 'o' 115 's' 99 'c'  99 'c'  46 '.'  97 'a'  100 'd' 109 'm'
0x7f83bfafacc0: 105 'i' 110 'n' 117 'u' 115 's' 101 'e' 114 'r' 115 's' 0 '\000'
0x7f83bfafacc8: 0 '\000'1 '\001'111 'o' 107 'k' 0 '\000'
0 '\000'0 '\000'0 '\000'
0x7f83bfafacd0: 0 '\000'0 '\000'0 '\000'-16 '\360'  
63 '?'  0 '\000'0 '\000'0 '\000'

If you check the original post you will see:

#15 0x0053f732 in PyEval_EvalFrameEx (throwflag=0, 
f=Frame 0x17882e8, for file 
/usr/local/lib/python3.7/dist-packages/bson/__init__.py, line 1013, in 
decode_all 
(data=b'V\x00\x00\x00\x03cursor\x00=\x00\x00\x00\x04firstBatch\x00\x05\x00\x00\x00\x00\x12id\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02ns\x00\x13\x00\x00\x00gecoscc.adminusers\x00\x00\x01ok\x00\x00\x00\x00\x00\x00\x00\xf0?\x00',
 codec_options=, view=, data_len=86, docs=[], position=0, end=85)) at 
../Python/ceval.c:547

So, somehow the "oscc.adminusers\x00\x00\x01ok\x00" part of the message is 
written over the exc_info memory.

That makes me think that this is a problem in pymongo module. I will report 
this bug to them.

Thank you very much!

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



[issue43631] Update to OpenSSL 1.1.1k

2021-03-26 Thread Christian Heimes


Change by Christian Heimes :


--
keywords: +patch
pull_requests: +23774
pull_request: https://github.com/python/cpython/pull/25024

___
Python tracker 

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



[issue43631] Update to OpenSSL 1.1.1k

2021-03-26 Thread Christian Heimes


New submission from Christian Heimes :

OpenSSL 1.1.1k contains fixes for two high severity CVEs

https://www.openssl.org/news/vulnerabilities.html
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3450
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3449

--
assignee: christian.heimes
components: SSL, Windows, macOS
messages: 389541
nosy: christian.heimes, ned.deily, paul.moore, ronaldoussoren, steve.dower, 
tim.golden, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Update to OpenSSL 1.1.1k
type: security
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



[issue43630] unittest use dir(module) to load test cases. Run unittest file by _PyRun_SimpleFileObject, have bug

2021-03-26 Thread junyixie


New submission from junyixie :

_PyRun_SimpleFileObject load __main__ module at cache. Call this function 
multiple times, the attributes stored in the module dict will affect eachother.


for example. 
if we run test_A.py, call _PyRun_SimpleFileObject will create __main__ module, 
test_A.py add some attribute in __main__ module dict.

now we run test_B.py. call _PyRun_SimpleFileObject will load cached __main__ 
module. now in __main__ module dict, we can get test_A's attribute.




in unittest, if we execute test, and don't exit. (unittest main.py 
TestProgram), set exit=False.
```
def __init__(self, module='__main__', defaultTest=None, argv=None,
testRunner=None, testLoader=loader.defaultTestLoader,
exit=True, verbosity=1, failfast=None, catchbreak=None,
buffer=None, warnings=None, *, tb_locals=False):
```

dir(module), We got unexpected results
```
for name in dir(module):
...
```

then when unittest load tests. if we use _PyRun_SimpleFileObject to run 
unittest, it will Repeated load test cases
```
for name in dir(module):
obj = getattr(module, name)
if isinstance(obj, type) and issubclass(obj, case.TestCase):
tests.append(self.loadTestsFromTestCase(obj))
```


```
int
_PyRun_SimpleFileObject(FILE *fp, PyObject *filename, int closeit,
PyCompilerFlags *flags)
{
PyObject *m, *d, *v;
int set_file_name = 0, ret = -1;

m = PyImport_AddModule("__main__");
if (m == NULL)
return -1;
Py_INCREF(m);
d = PyModule_GetDict(m);
```

--
messages: 389540
nosy: JunyiXie
priority: normal
severity: normal
status: open
title: unittest use dir(module) to load test cases. Run unittest file by 
_PyRun_SimpleFileObject, have bug

___
Python tracker 

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



[issue43629] fix _PyRun_SimpleFileObject create __main__ module and cache. Call this function multiple times, the attributes stored in the module dict will affect eachother.

2021-03-26 Thread junyixie


Change by junyixie :


--
resolution:  -> wont fix

___
Python tracker 

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