[issue46655] typing.TypeAlias is not in the list of allowed plain _SpecialForm typeforms

2022-02-06 Thread Gregory Beauregard


Change by Gregory Beauregard :


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

___
Python tracker 

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



[issue46654] urllib.request.urlopen doesn't handle UNC paths produced by pathlib's as_uri() (but can handle UNC paths with additional slashes)

2022-02-06 Thread Eryk Sun


Eryk Sun  added the comment:

> The value of req.selector never starts with "//", for which file_open() 
> checks, but rather a single slash, such as "/Z:/test.py" or 
> "/share/test.py".

To correct myself, actually req.selector will start with "//" for a "file:" 
URI, such as "file:host/share/test.py". For this example, req.host is an 
empty string, so file_open() still ends up calling open_local_file(), which 
will open "//host/share/test.py". In Linux, "//host/share" is the same as 
"/host/share". In Cygwin and MSYS2 it's a UNC path. I guess this case should be 
allowed, even though the meaning of a "//" root isn't specifically defined in 
POSIX.

Unless I'm overlooking something, file_open() only has to check the value of 
req.host. In POSIX, it should require opening a 'local' path, i.e. if req.host 
isn't None, empty, or a local host, raise URLError.

In Windows, my tests show that the shell API special cases "localhost" (case 
insensitive) in "file:" URIs. For example, the following are all equivalent: 
"file:/C:/Temp", "file:///C:/Temp", and "file://localhost/C:/Temp". The shell 
API does not special case the real local host name or any of its IP addresses, 
such as 127.0.0.1. They're all handled as UNC paths.

Here's what I've experimented with thus far, which passes the existing urllib 
tests in Linux and Windows:

class FileHandler(BaseHandler):
def file_open(self, req):
if not self._is_local_path(req):
if sys.platform == 'win32':
path = url2pathname(f'//{req.host}{req.selector}')
else:
raise URLError("In POSIX, the file:// scheme is only "
   "supported for local file paths.")
else:
path = url2pathname(req.selector)
return self._common_open_file(req, path)


def _is_local_path(self, req):
if req.host:
host, port = _splitport(req.host)
if port:
raise URLError(f"the host cannot have a port: {req.host}")
if host.lower() != 'localhost':
# In Windows, all other host names are UNC.
if sys.platform == 'win32':
return False
# In POSIX, support all names for the local host.
if _safe_gethostbyname(host) not in self.get_names():
return False
return True


# names for the localhost
names = None
def get_names(self):
if FileHandler.names is None:
try:
FileHandler.names = tuple(
socket.gethostbyname_ex('localhost')[2] +
socket.gethostbyname_ex(socket.gethostname())[2])
except socket.gaierror:
FileHandler.names = (socket.gethostbyname('localhost'),)
return FileHandler.names


def open_local_file(self, req):
if not self._is_local_path(req):
raise URLError('file not on local host')
return self._common_open_file(req, url2pathname(req.selector))


def _common_open_file(self, req, path):
import email.utils
import mimetypes
host = req.host
filename = req.selector
try:
if host:
origurl = f'file://{host}{filename}'
else:
origurl = f'file://{filename}'
stats = os.stat(path)
size = stats.st_size
modified = email.utils.formatdate(stats.st_mtime, usegmt=True)
mtype = mimetypes.guess_type(filename)[0] or 'text/plain'
headers = email.message_from_string(
f'Content-type: {mtype}\n'
f'Content-length: {size}\n'
f'Last-modified: {modified}\n')
return addinfourl(open(path, 'rb'), headers, origurl)
except OSError as exp:
raise URLError(exp)


Unfortunately nturl2path.url2pathname() parses some UNC paths incorrectly. For 
example, the following path should be an invalid UNC path, since "C:" is an 
invalid name, but instead it gets converted into an unrelated local path.

>>> nturl2path.url2pathname('//host/C:/Temp/spam.txt')
'C:\\Temp\\spam.txt'

This goof depends on finding ":" or "|" in the path. It's arguably worse if the 
last component has a named data stream (allowed by RFC 8089):

>>> nturl2path.url2pathname('//host/share/spam.txt:eggs')
'T:\\eggs'

Drive "T:" is from "t:" in "t:eggs", due to simplistic path parsing.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https

[issue46656] Compile fails if Py_NO_NAN is defined

2022-02-06 Thread Mark Dickinson


New submission from Mark Dickinson :

The macro Py_NAN may or may not be defined: in particular, a platform that 
doesn't have NaNs is supposed to be able to define Py_NO_NAN in pyport.h to 
indicate that.

But not all of our uses of `Py_NAN` are guarded by suitable #ifdef 
conditionals. As a result, compilation fails if Py_NAN is not defined.

--
messages: 412620
nosy: mark.dickinson
priority: normal
severity: normal
status: open
title: Compile fails if Py_NO_NAN is defined
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue46656] Compile fails if Py_NO_NAN is defined

2022-02-06 Thread Mark Dickinson


Mark Dickinson  added the comment:

Here's the first point of failure on my machine. Fixing this shows up more 
failures.

gcc -c -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall
-std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers 
-Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  
-I./Include/internal  -I. -I./Include-DPy_BUILD_CORE -o 
Objects/complexobject.o Objects/complexobject.c
Objects/complexobject.c:120:27: error: use of undeclared identifier 'Py_NAN'
r.real = r.imag = Py_NAN;
  ^
Objects/complexobject.c:206:16: error: use of undeclared identifier 'Py_NAN'
return Py_NAN;
   ^
2 errors generated.
make: *** [Objects/complexobject.o] Error 1

--

___
Python tracker 

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



[issue46652] Use code.co_qualname to provide richer information

2022-02-06 Thread Gabriele N Tornetta


Gabriele N Tornetta  added the comment:

code.co_qualname was introduced in 2021 with bpo-44530 and shuold give the same 
guarantees as code.co_name. The __qualname__ attribute is derived from 
code.co_qualname, so perhaps Cython can benefit from accessing code.co_qualname 
directly instead?

--

___
Python tracker 

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There were two reasons of accepting arbitrary callables in _type_check():

1. NewType() returned a function.
2. xml.etree.cElementTree.Element was a function in Python 2.

Now NewType is a class, and Python 2 no longer supported. I agree that we 
should get rid of the callable() check, but I disagree with the proposed 
change. The check should be more explicit and strict, not more lenient. 
List[42] does not make sense and should not be accepted.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +29332
pull_request: https://github.com/python/cpython/pull/31159

___
Python tracker 

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



[issue46640] Python can now use the C99 NAN constant

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 54842e4311bb0e34012d1984b42eab41eeeaea6a by Victor Stinner in 
branch 'main':
bpo-46640: Py_NAN now uses the C99 NAN constant (GH-31134)
https://github.com/python/cpython/commit/54842e4311bb0e34012d1984b42eab41eeeaea6a


--

___
Python tracker 

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



[issue46656] Compile fails if Py_NO_NAN is defined

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:

Python uses Py_NAN without "#ifdef Py_NAN" guard since 2008. Building Python 
with Py_NO_NAN never worked. Nobody reported such build failure in the last 14 
years...

IMO it's time to stop supporting platforms without NaN support.


> Objects/complexobject.c:120:27: error: use of undeclared identifier 'Py_NAN'

I only try a few Python versions: I reproduce this issue in Python 3.11, 3.5, 
3.2 and... even Python 2.7!

The Py_NO_NAN macro was introduced in Python 2.6 (2007) by bpo-1635 "Float 
patch for inf and nan on Windows (and other platforms)":
--
commit 0a8143f6462b491d3f12bfb899efd6e044e350be
Author: Christian Heimes 
Date:   Tue Dec 18 23:22:54 2007 +

Applied patch #1635: Float patch for inf and nan on Windows (and other 
platforms).

The patch unifies float("inf") and repr(float("inf")) on all platforms.

(...)

+#if !defined(Py_NAN) && !defined(Py_NO_NAN)
+#define Py_NAN (Py_HUGE_VAL * 0.)
+#endif
---

The following change started to use Py_NAN in many C files:

* Modules/cmathmodule.c
* Objects/complexobject.c
* Objects/floatobject.c
* Python/pymath.c 

---
commit 6f34109384f3a78d5f4f8bdd418a89caca19631e (HEAD)
Author: Christian Heimes 
Date:   Fri Apr 18 23:13:07 2008 +

I finally got the time to update and merge Mark's and my trunk-math branch. 
The patch is collaborated w
ork of Mark Dickinson and me. It was mostly done a few months ago. The patch 
fixes a lot of loose ends and 
edge cases related to operations with NaN, INF, very small values and complex 
math.

The patch also adds acosh, asinh, atanh, log1p and copysign to all 
platforms. Finally it fixes differen
ces between platforms like different results or exceptions for edge cases. Have 
fun :)
---

At this commit, floatobject.c and pymath.c use "#ifdef Py_NAN" carefully, 
whereas cmathmodule.c and complexobject.c use Py_NAN with no "#ifdef Py_NAN" 
guard.

--
nosy: +vstinner

___
Python tracker 

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



[issue46640] Python can now use the C99 NAN constant or __builtin_nan()

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:

I merged my change, thanks for the reviews.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
title: Python can now use the C99 NAN constant -> Python can now use the C99 
NAN constant or __builtin_nan()

___
Python tracker 

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



[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Note that instances of most other types are non-subclassable "by accident".

>>> class A(42): pass
... 
Traceback (most recent call last):
  File "", line 1, in 
TypeError: int() takes at most 2 arguments (3 given)

>>> class B:
... def __init__(self, *args): pass
... 
>>> class C(B()): pass
... 
>>> C
<__main__.B object at 0x7fdcfb49aae0>

It is okay until we decide that there is a problem, and it that case it would 
require more general solution.

Are there any issues with this in real code?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue46187] Optionally support rounding for math.isqrt()

2022-02-06 Thread Mark Dickinson


Mark Dickinson  added the comment:

Thanks, Tim; very interesting. I hadn't seen this factoring algorithm before.

> That wants the _ceiling_ of the square root.

Looks like what it actually wants is the ceiling analog of isqrtrem: that is, 
it needs both the ceiling of the square root *and* the difference between the 
square of that ceiling and the original number.

The description of the algorithm in section 2 is a bit odd: they define m := 
s*s % n, using an expensive modulo operation, when all they need is a 
subtraction: m := s*s - n*i. This is noted in section 3 ("to reduce modulo Mn 
at step 3, one may simply subtract Mni from s2"), but they fail to note that 
the two things aren't equivalent for large enough i, possibly because that 
large an i won't be used in practice. And in the case that the two quantities 
differ, it's the subtraction that's needed to make the algorithm work, not the 
mod result.

Here's a Python version of Hart's algorithm:


from itertools import count
from math import gcd, isqrt

def isqrtrem(n):
""" For n >= 0, return s, r satisfying s*s + r == n, 0 <= r <= 2*s. """
s = isqrt(n)
return s, n - s*s

def csqrtrem(n):
""" For n > 0, return s, r satisfying n + s*s == r, 0 <= r <= 2*(s-1). """
s = 1 + isqrt(n-1)
return s, s*s - n

def factor(n):
""" Attempt to use Hart's algorithm to find a factor of n. """
for i in count(start=1):
s, m = csqrtrem(n*i)
t, r = isqrtrem(m)
if not r:
return gcd(n, s-t)

--

___
Python tracker 

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



[issue46656] Compile fails if Py_NO_NAN is defined

2022-02-06 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue46656] Compile fails if Py_NO_NAN is defined

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:

If someone suddenly requires platforms without NaN support, they can maintain a 
(downstream) patch, or we can revert the change in Python.

--

___
Python tracker 

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



[issue46656] Compile fails if Py_NO_NAN is defined

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-46640 "Python can now use the C99 NAN constant or __builtin_nan()".

--

___
Python tracker 

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



[issue46187] Optionally support rounding for math.isqrt()

2022-02-06 Thread Mark Dickinson


Mark Dickinson  added the comment:

Ah, 
https://math.mit.edu/research/highschool/primes/materials/2019/Gopalakrishna.pdf
 is interesting - they conjecture a bound on the number of iterations required, 
and note that under that conjecture the mod can be replaced by a subtraction.

--

___
Python tracker 

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



[issue46648] `test.test_urllib2.MiscTests.test_issue16464` started to fail

2022-02-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +29334
pull_request: https://github.com/python/cpython/pull/31161

___
Python tracker 

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



[issue46656] Compile fails if Py_NO_NAN is defined

2022-02-06 Thread Mark Dickinson


Mark Dickinson  added the comment:

Okay, the comments I made on #46640 still apply (even though they didn't 
properly apply on that issue). I think this needs a python-dev discussion 
before it can be moved forward - requiring the existence of NaNs is very close 
to requiring IEEE 754 floating-point, and that's something we've been 
historically reluctant to do.

--

___
Python tracker 

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



[issue23952] cgi: Document the 'maxlen' member of the cgi module

2022-02-06 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 6c4e44ef8ab550f846ba056d4561efb8256b8eab by Hugo van Kemenade in 
branch 'main':
bpo-23952: Document cgi module's maxlen variable (GH-30338)
https://github.com/python/cpython/commit/6c4e44ef8ab550f846ba056d4561efb8256b8eab


--

___
Python tracker 

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



[issue23952] cgi: Document the 'maxlen' member of the cgi module

2022-02-06 Thread Ethan Furman


Change by Ethan Furman :


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



[issue46586] In documentation contents enum.property erroneously links to built-in property

2022-02-06 Thread Ethan Furman


Ethan Furman  added the comment:

In case a future reader has the same question:

A tilde (~) creates a link to whatever follows (so `enum.property` above), but 
only shows the last segment in the text (so `property`).

--

___
Python tracker 

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



[issue46586] In documentation contents enum.property erroneously links to built-in property

2022-02-06 Thread Ethan Furman


Change by Ethan Furman :


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

___
Python tracker 

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



[issue46648] `test.test_urllib2.MiscTests.test_issue16464` started to fail

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1578de2fcd685c71f9c84e09bac32901dea192c1 by Victor Stinner in 
branch 'main':
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)
https://github.com/python/cpython/commit/1578de2fcd685c71f9c84e09bac32901dea192c1


--

___
Python tracker 

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



[issue46648] `test.test_urllib2.MiscTests.test_issue16464` started to fail

2022-02-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29336
pull_request: https://github.com/python/cpython/pull/31163

___
Python tracker 

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



[issue46648] `test.test_urllib2.MiscTests.test_issue16464` started to fail

2022-02-06 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46656] Compile fails if Py_NO_NAN is defined

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:

Is the macro PY_NO_SHORT_FLOAT_REPR also related to platforms which don't 
support IEEE 754?

In 2022, which platforms don't support IEEE 754?

--

___
Python tracker 

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



[issue46648] `test.test_urllib2.MiscTests.test_issue16464` started to fail

2022-02-06 Thread miss-islington


miss-islington  added the comment:


New changeset 1b8a34ae65688cfadc81e0174b5aea979b264b3e by Miss Islington (bot) 
in branch '3.9':
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)
https://github.com/python/cpython/commit/1b8a34ae65688cfadc81e0174b5aea979b264b3e


--

___
Python tracker 

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



[issue46648] `test.test_urllib2.MiscTests.test_issue16464` started to fail

2022-02-06 Thread miss-islington


miss-islington  added the comment:


New changeset c88407ccf5e72d00e909c2399ff7163501aa7089 by Miss Islington (bot) 
in branch '3.10':
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)
https://github.com/python/cpython/commit/c88407ccf5e72d00e909c2399ff7163501aa7089


--

___
Python tracker 

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



[issue46657] Add mimalloc memory allocator

2022-02-06 Thread Christian Heimes


New submission from Christian Heimes :

>From https://github.com/microsoft/mimalloc

> mimalloc (pronounced "me-malloc") is a general purpose allocator with 
> excellent performance characteristics. Initially developed by Daan Leijen for 
> the run-time systems of the Koka and Lean languages.

mimalloc has several interesting properties that make it useful for CPython. 
Amongst other it is fast, thread-safe, and NUMA-aware. It has built-in free 
lists with multi-sharding and allocation heaps. While Python's obmalloc 
requires the GIL to protect its data structures, mimalloc uses mostly 
thread-local and atomic instructions (compare-and-swap) for efficiency. Sam 
Gross' nogil relies on mimalloc's thread safety and uses first-class heaps for 
heap walking GC.

mimalloc works on majority of platforms and CPU architectures. However it 
requires a compiler with C11 atomics support. CentOS 7's default GCC is 
slightly too old, more recent GCC from Developer Toolset is required. 

For 3.11 I plan to integrate mimalloc as an optional drop-in replacement for 
obmalloc. Users will be able to compile CPython without mimalloc or disable 
mimalloc with PYTHONMALLOC env var. Since mimalloc will be optional in 3.11, 
Python won't depend or expose on any of the advanced features yet. The approach 
enables the community to test and give feedback with minimal risk of breakage.

mimalloc sources will vendored without any option to use system libraries. 
Python's mimalloc requires several non-standard compile-time flags. In the 
future Python may extend or modify mimalloc for heap walking and nogil, too.

(This is a tracking bug until I find time to finish a PEP.)

--
components: Interpreter Core
messages: 412639
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Add mimalloc memory allocator
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue46656] Compile fails if Py_NO_NAN is defined

2022-02-06 Thread Mark Dickinson


Mark Dickinson  added the comment:

> Is the macro PY_NO_SHORT_FLOAT_REPR also related to platforms which don't 
> support IEEE 754?

Yes, though it's a bit more than that: we also need the platform either not to 
have issues with double rounding for normal numbers, or we need to be able to 
control the x87 rounding mode in the case that double rounding might be an 
issue. See the explanations in the source.

https://github.com/python/cpython/blob/025cbe7a9b5d3058ce2eb8015d3650e396004545/Include/pyport.h#L345-L355

> In 2022, which platforms don't support IEEE 754?

None that CPython might plausibly run on that I'm aware of.

--

___
Python tracker 

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



[issue46657] Add mimalloc memory allocator

2022-02-06 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue46657] Add mimalloc memory allocator

2022-02-06 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10, nascheme

___
Python tracker 

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



[issue46657] Add mimalloc memory allocator

2022-02-06 Thread Dong-hee Na


Dong-hee Na  added the comment:

I add Neil to the nosy list since he is one of the kick-off members with this 
amazing works :)

--

___
Python tracker 

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



[issue46656] Compile fails if Py_NO_NAN is defined

2022-02-06 Thread Mark Dickinson


Mark Dickinson  added the comment:

> See the explanations in the source.

Hmm. Those explanations made more sense before PR GH-28882. :-(

--

___
Python tracker 

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



[issue46648] `test.test_urllib2.MiscTests.test_issue16464` started to fail

2022-02-06 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue46658] shutil Lib enables sendfile on solaris for regular files

2022-02-06 Thread David CARLIER


New submission from David CARLIER :

- sendfile on solaris supports copy between regular file descriptors as well.

--
components: Library (Lib)
messages: 412643
nosy: devnexen
priority: normal
pull_requests: 29338
severity: normal
status: open
title: shutil Lib enables sendfile on solaris for regular files
versions: Python 3.11

___
Python tracker 

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



[issue46586] In documentation contents enum.property erroneously links to built-in property

2022-02-06 Thread Meer Suri


Meer Suri  added the comment:

(First time contributor here seeking guidance) I see that this problem of 
automatically linking to the unintended page has occurred in other parts of the 
docs and has been handled in another way - In Doc/library/functions.rst, local 
targets are used with replacement texts-

unintended linking code- :func:`dict`
local target code- |func-dict|_ 
and this substitution is added-  .. |func-dict| replace:: ``dict()``

Would this be the preferred way of solving this? I tried this change and it 
achieves the correct linking for me

--
nosy: +meersuri

___
Python tracker 

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



[issue46657] Add mimalloc memory allocator

2022-02-06 Thread Christian Heimes


Christian Heimes  added the comment:

New features:

- vendored mimalloc 2.0.3 + two patches from mimalloc dev branch. Mimalloc is 
embedded in obmalloc.o. Symbols are either hidden or names are mangled to have 
a _Py_ prefix.
- ./configure --with[out]-mimalloc (default: yes), fails if atomics are not 
available.
- PYTHONMALLOC=mimalloc, PYTHONMALLOC=mimalloc-debug env var settings
- PYMEM_ALLOCATOR_MIMALLOC, PYMEM_ALLOCATOR_MIMALLOC_DEBUG
- sys.debugmallocstats() and _PyObject_DebugMallocStats() prints mimalloc stats
- sys._malloc_info struct, contains information about available and current 
allocator

--

___
Python tracker 

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



[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-06 Thread Gregory Beauregard


Gregory Beauregard  added the comment:

The issue in real code I had in mind was internal to cpython: if we remove the 
callable() check from _type_check naively, this test starts to fail. Both of 
our proposed changes happen to not fail this check. Given your second example, 
would you prefer if we remove this testcase if the issue comes up in the final 
proposed patches? On the other hand, there is precedent for giving this a nice 
error message other places in typing.py.

--

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor


New submission from STINNER Victor :

The locale.getdefaultlocale() function only relies on environment variables. At 
Python startup, Python calls setlocale() is set the LC_CTYPE locale to the user 
preferred encoding.

Since Python 3.7, if the LC_CTYPE locale is "C" or "POSIX", PEP 538 sets the 
LC_CTYPE locale to a UTF-8 variant if available, and PEP 540 ignores the locale 
and forces the usage of the UTF-8 encoding. The *effective* encoding used by 
Python is inconsistent with environment variables.

Moreover, if setlocale() is called to set the LC_CTYPE locale to a locale 
different than the user locale, again, environment variables are inconsistent 
with the effective locale.

In these cases, locale.getdefaultlocale() result is not the expected locale and 
it can lead to mojibake and other issues.

For these reasons, I propose to deprecate locale.getdefaultlocale(): 
setlocale(), getpreferredencoding() and getlocale() should be used instead.

For the background on these issues, see recent issue:

* bpo-43552
* bpo-43557

--
components: Library (Lib)
messages: 412647
nosy: vstinner
priority: normal
severity: normal
status: open
title: Deprecate locale.getdefaultlocale() function
versions: Python 3.11

___
Python tracker 

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



[issue43557] Deprecate getdefaultlocale(), getlocale() and normalize() functions

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:

Deprecating these functions is complex. I prefer to start with the least 
controversial part: bpo-46659.

--

___
Python tracker 

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



[issue46660] datetime.datetime.fromtimestamp

2022-02-06 Thread Sam Roberts


New submission from Sam Roberts :

Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit 
(AMD64)] on win32

datetime.fromtimestamp() fails for naive-datetime values prior to the start of 
the epoch, but for some reason works properly for aware-datetime values prior 
to the start of the epoch.

This is at least inconsistent, but seems like a bug.

Negative timestamps for dates prior to the start of the epoch are used by yahoo 
finance and in the yfinance module.

>>> import datetime
>>> start = int(datetime.datetime(1962, 1, 31, 
>>> tzinfo=datetime.timezone.utc).timestamp())
>>> start
-249868800
>>> start = int(datetime.datetime(1962, 1, 31).timestamp())
Traceback (most recent call last):
  File "", line 1, in 
start = int(datetime.datetime(1962, 1, 31).timestamp())
OSError: [Errno 22] Invalid argument

--
components: Library (Lib)
messages: 412649
nosy: smrpy
priority: normal
severity: normal
status: open
title: datetime.datetime.fromtimestamp
type: behavior
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



[issue46660] datetime.fromtimestamp() fails for naive-datetime values prior to the start of the epoch

2022-02-06 Thread Sam Roberts


Change by Sam Roberts :


--
title: datetime.datetime.fromtimestamp -> datetime.fromtimestamp() fails for 
naive-datetime values prior to the start of the epoch

___
Python tracker 

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



[issue46660] datetime.timestamp() fails for naive-datetime values prior to the start of the epoch

2022-02-06 Thread Sam Roberts


Sam Roberts  added the comment:

the first sentence should have read:

datetime.timestamp() fails for naive-datetime values prior to the start of the 
epoch, but for some reason works properly for aware-datetime values prior to 
the start of the epoch.

--
title: datetime.fromtimestamp() fails for naive-datetime values prior to the 
start of the epoch -> datetime.timestamp() fails for naive-datetime values 
prior to the start of the epoch

___
Python tracker 

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Gregory Beauregard


Gregory Beauregard  added the comment:

List[42] is already accepted, and your proposed patch does not change it to 
make it not accepted. The issue is _type_check is only called in a few 
particular locations; this is part of the technical reason I'm not very 
concerned about relaxing the _type_check requirements.

>From a type checking philosophy point of view I agree with Jelle and am 
>negative on strict runtime requirements in typing.py.

--

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:

cal_locale.py: Test calendar.LocaleTextCalendar() default locale, manual test 
for GH-31166.

--
Added file: https://bugs.python.org/file50605/cal_locale.py

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor


Change by STINNER Victor :


Removed file: https://bugs.python.org/file50605/cal_locale.py

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor


Change by STINNER Victor :


Added file: https://bugs.python.org/file50606/cal_locale.py

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +29340
pull_request: https://github.com/python/cpython/pull/31167

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +29341
pull_request: https://github.com/python/cpython/pull/31168

___
Python tracker 

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



[issue46661] Duplicat deprecation warnings in docs for asyncio

2022-02-06 Thread Guido van Rossum


New submission from Guido van Rossum :

I found that several asyncio function descriptions, e.g. gather, have a 
duplicate deprecation notice like this:

   .. deprecated-removed:: 3.8 3.10
  The ``loop`` parameter.  This function has been implicitly getting the
  current running loop since 3.7.  See
  :ref:`What's New in 3.10's Removed section `
  for more information.

For gather, that notice appears both before and after the example. For a few 
others, too.

--
assignee: docs@python
components: Documentation, asyncio
messages: 412653
nosy: asvetlov, docs@python, gvanrossum, yselivanov
priority: normal
severity: normal
status: open
title: Duplicat deprecation warnings in docs for asyncio
versions: Python 3.10, Python 3.11, 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



[issue46657] Add mimalloc memory allocator

2022-02-06 Thread Christian Heimes


Christian Heimes  added the comment:

Buildbots "PPC64 Fedora PR" and all RHEL 7 build bots provided by David 
Edelsohn are failing because compiler is missing support for stdatomic.h.

--

___
Python tracker 

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



[issue46662] Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp

2022-02-06 Thread Bo-wei Chen


New submission from Bo-wei Chen :

convert_timestamp function in Lib/sqlite3/dbapi2.py fails to parse a timestamp 
correctly, if it does not have microseconds but comes with timezone 
information, e.g. b"2022-02-01 16:09:35+00:00"

Traceback:

Traceback (most recent call last):
  File "/Users/user/Desktop/test.py", line 121, in 
convert_timestamp(b"2022-02-01 16:09:35+00:00")
  File "/Users/user/Desktop/test.py", line 112, in convert_timestamp
hours, minutes, seconds = map(int, timepart_full[0].split(b":"))
ValueError: invalid literal for int() with base 10: b'35+00'

--
components: Library (Lib)
messages: 412655
nosy: Rayologist
priority: normal
severity: normal
status: open
title: Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly 
parse timestamp
type: behavior
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



[issue46662] Lib/sqlite3/dbapi2.py: convert_timestamp function failed to correctly parse timestamp

2022-02-06 Thread Bo-wei Chen


Change by Bo-wei Chen :


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

___
Python tracker 

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



[issue46180] Button clicked failed when mouse hover tooltip and tooltip destroyed

2022-02-06 Thread PySimpleGUI


PySimpleGUI  added the comment:

I'm sorry for not getting back quicker on the Linux testing.  I've not figured 
out how to get 8.6.12 up and running on my Linux environment.  I've tried both 
Python 3.9 and Python 3.10 and neither have 8.6.12.

--
Added file: https://bugs.python.org/file50607/Linux3.10.jpg

___
Python tracker 

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



[issue25970] py_compile.compile fails if existing bytecode file is unwritable

2022-02-06 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue31057] pydoc for tempfile.TemporaryDirectory should say it returns the name

2022-02-06 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue40174] HAVE_CLOCK_GETTIME not repected in pytime.c

2022-02-06 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue45412] [C API] Remove Py_OVERFLOWED(), Py_SET_ERRNO_ON_MATH_ERROR(), Py_ADJUST_ERANGE1()

2022-02-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +29343
pull_request: https://github.com/python/cpython/pull/31171

___
Python tracker 

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

No, List[42] is not currently accepted.

>>> List[42]
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/typing.py", line 318, in inner
return func(*args, **kwds)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 1127, in __getitem__
params = tuple(_type_check(p, msg) for p in params)
 ^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 1127, in 
params = tuple(_type_check(p, msg) for p in params)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 184, in _type_check
raise TypeError(f"{msg} Got {arg!r:.100}.")
^^^
TypeError: Parameters to generic types must be types. Got 42.

--

___
Python tracker 

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Gregory Beauregard


Gregory Beauregard  added the comment:

I'm referring to within type annotations, where this code path isn't used: try 
a: List[42]

This code path can show up in type aliases though.

--

___
Python tracker 

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



[issue46654] urllib.request.urlopen doesn't handle UNC paths produced by pathlib's as_uri() (but can handle UNC paths with additional slashes)

2022-02-06 Thread Emanuelle Pharand


Change by Emanuelle Pharand :


--
assignee:  -> docs@python
components: +2to3 (2.x to 3.x conversion tool), Argument Clinic, Build, C API, 
Cross-Build, Demos and Tools, Distutils, Documentation, Extension Modules, 
FreeBSD, IDLE, IO, Installation, Interpreter Core, Library (Lib), Parser, 
Regular Expressions, SSL, Subinterpreters, Tests, Tkinter, Unicode, Windows, 
XML, asyncio, ctypes, email, macOS
nosy: +Alex.Willmer, asvetlov, barry, docs@python, dstufft, eric.araujo, 
ezio.melotti, koobs, ladykraken, larry, lys.nikolaou, mrabarnett, ned.deily, 
pablogsal, paul.moore, r.david.murray, ronaldoussoren, steve.dower, 
terry.reedy, tim.golden, vstinner, yselivanov, zach.ware
type:  -> performance
versions: +Python 3.10, Python 3.11, 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



[issue46660] datetime.timestamp() fails for naive-datetime values prior to the start of the epoch

2022-02-06 Thread Sam Roberts


Sam Roberts  added the comment:

this seems like an expected discrepancy because of a difference in the 
mechanism used for aware datatimes vs. naive datetimes, although I'm not sure I 
understand why the computation with naive datetimes uses the mktime() function 
rather than invoking datetime.timedelta.total_seconds() on a datetime 
difference.

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



[issue46660] datetime.timestamp() fails for naive-datetime values prior to the start of the epoch

2022-02-06 Thread Sam Roberts


Change by Sam Roberts :


--
resolution:  -> not a bug

___
Python tracker 

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

But it gives the same result.

What version of Python do you test with?

--

___
Python tracker 

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



[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The test is good. If we accidentally make a TypeVar instance subclassable, it 
will catch such error.

--

___
Python tracker 

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Gregory Beauregard


Gregory Beauregard  added the comment:

I compiled your PR to run it and was testing in 3.10 as well, but I was testing 
in a file with from __future__ import annotations unintentionally. I retract 
the comment. It turns out `list[42]` is okay though, which I suppose is more 
relevant going forward. My confusion here is sort of the crux of my problem 
with these runtime checks: they are inconsistently applied in different 
locations which is why callable() was causing a lot of bugs.

--

___
Python tracker 

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



[issue46663] test_math test_cmath test_complex fails on Fedora Rawhide buildbots

2022-02-06 Thread STINNER Victor


New submission from STINNER Victor :

PPC64LE Fedora Rawhide LTO 3.10:
https://buildbot.python.org/all/#/builders/674/builds/543

3 tests failed: test_cmath test_complex test_math

That's a GCC 12 regression: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104389

--
components: Tests
messages: 412663
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_math test_cmath test_complex fails on Fedora Rawhide buildbots
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 04dd60e50cd3da48fd19cdab4c0e4cc600d6af30 by Victor Stinner in 
branch 'main':
bpo-46659: Update the test on the mbcs codec alias (GH-31168)
https://github.com/python/cpython/commit/04dd60e50cd3da48fd19cdab4c0e4cc600d6af30


--

___
Python tracker 

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



[issue29240] PEP 540: Add a new UTF-8 mode

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:

> New changeset 91106cd9ff2f321c0f60fbaa09fd46c80aa5c266 by Victor Stinner in 
> branch 'master':
> bpo-29240: PEP 540: Add a new UTF-8 Mode (#855)
> https://github.com/python/cpython/commit/91106cd9ff2f321c0f60fbaa09fd46c80aa5c266

Oh, this change broke the mbcs alias on Windows and the test_codecs and 
test_site tests (2 tests!) missed the bug :-( I fixed it in:

New changeset 04dd60e50cd3da48fd19cdab4c0e4cc600d6af30 by Victor Stinner in 
branch 'main':
bpo-46659: Update the test on the mbcs codec alias (GH-31168)
https://github.com/python/cpython/commit/04dd60e50cd3da48fd19cdab4c0e4cc600d6af30

--

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 06b8f1615b09099fae5c5393334b8716a4144d20 by Victor Stinner in 
branch 'main':
bpo-46659: test.support avoids locale.getdefaultlocale() (GH-31167)
https://github.com/python/cpython/commit/06b8f1615b09099fae5c5393334b8716a4144d20


--

___
Python tracker 

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



[issue46648] `test.test_urllib2.MiscTests.test_issue16464` started to fail

2022-02-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29344
pull_request: https://github.com/python/cpython/pull/31173

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

> For these reasons, I propose to deprecate locale.getdefaultlocale(): 
> setlocale(), getpreferredencoding() and getlocale() should be used instead.

Please see the discussion on https://bugs.python.org/issue43552: 
locale.getpreferredencoding() needs to be deprecated as well. Instead we should 
have a single locale.getencoding() as outlined there... perhaps in a separate 
ticket ?! Thanks.

--
nosy: +lemburg

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:

> Please see the discussion on https://bugs.python.org/issue43552: 
> locale.getpreferredencoding() needs to be deprecated as well. Instead we 
> should have a single locale.getencoding() as outlined there... perhaps in a 
> separate ticket ?! Thanks.

Yeah, I read this issue. But these things are too complicated :-) I prefer to 
move step by step.

Once locale.getencoding() (or a similar function) is added, we can update the 
deprecation message.

I hope to be able to deprecate getdefaultlocale() and to add such new function 
in Python 3.11.

--

___
Python tracker 

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



[issue46657] Add mimalloc memory allocator

2022-02-06 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

Thanks, I'm indeed interested.  Most credit goes to Christian for advancing 
this.

For the missing stdatomic.h, would it be appropriate to have an autoconfig 
check for it?  Can just disable mimalloc if it doesn't exist.

--

___
Python tracker 

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



[issue46664] PY_SSIZE_T_MAX is not an integer constant expression

2022-02-06 Thread ov2k


New submission from ov2k :

PY_SSIZE_T_MAX is currently defined in Include/pyport.h as: 

#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1))

This is not an integer constant expression, which means it can't be used in 
preprocessor conditionals.  For example: 

#if PY_SSIZE_T_MAX > UINT32_MAX

will fail to compile.  This was touched upon and ignored a long time ago: 

https://mail.python.org/archives/list/python-...@python.org/thread/27X7LINL4UO7DAJE6J3IFQEZGUKAO4VL/

I think the best fix is to move the definition of PY_SSIZE_T_MAX (and 
PY_SSIZE_T_MIN) next to the definition of Py_ssize_t, and use the proper 
corresponding limit macro.  If Py_ssize_t is a typedef for ssize_t, then 
PY_SSIZE_T_MAX should be SSIZE_MAX.  If Py_ssize_t is a typedef for 
Py_intptr_t, then PY_SSIZE_T_MAX should be INTPTR_MAX.  There's a minor 
complication because Py_ssize_t can be defined in PC/pyconfig.h.  I'm not so 
familiar with the various Windows compilers, so I'm not sure what's best to do 
here.  I think __int64 has a corresponding _I64_MAX macro, and int obviously 
has INT_MAX.

--
components: C API
messages: 412670
nosy: ov2k
priority: normal
severity: normal
status: open
title: PY_SSIZE_T_MAX is not an integer constant expression
type: compile error
versions: Python 3.10, Python 3.11, 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



[issue46664] PY_SSIZE_T_MAX is not an integer constant expression

2022-02-06 Thread ov2k


Change by ov2k :


--
type: compile error -> enhancement

___
Python tracker 

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



[issue46665] IDLE Windows shortcuts by default

2022-02-06 Thread primexx


New submission from primexx :

In IDLE on Windows, there are certain keyboard shortcut idiosycracies in the 
default configuration. 

For example,

redo is ctrl+shift+z (standard elsewhere) rather than ctrl+y (Microsoft's 
standard)

de-indenting is ctrl+[ rather than shift+tab (also affects multi-line selected 
behaviour)

Request: adjust the defaults based on OS platform and use windows style by 
default on windows

If this is a dupe I apologize. I tried to search for an existing issue but 
wasn't able to find any with the keywords i can think of

--
assignee: terry.reedy
components: IDLE
messages: 412671
nosy: primexx, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE Windows shortcuts by default
versions: Python 3.10, Python 3.11, 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



[issue46666] IDLE indent guide

2022-02-06 Thread primexx


New submission from primexx :

Request: support indent guide for IDLE in editor window (i.e. not interactive 
shell)

there appears to not be currently support for indent guides in idle

one take is that idle is meant for small scripts and one should seek out a more 
complex IDE if it gets to the point of needing indent lines 
https://stackoverflow.com/q/66231105

i think that there would still be value in indent lines even in IDLE. it is a 
popular IDE for beginners and even in short scripts there can still be 
sufficiently large indented blocks, relatively speaking. it doesn't take that 
much code for indent guides to become helpful.

--
assignee: terry.reedy
components: IDLE
messages: 412672
nosy: primexx, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE indent guide
versions: Python 3.10, Python 3.11, 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



[issue46667] SequenceMatcher & autojunk - false negative

2022-02-06 Thread Jonathan


New submission from Jonathan :

The following two strings are identical other than the text "UNIQUESTRING".
UNIQUESTRING is at the start of first and at the end of second.
Running the below gives the following output:


0.99830220713073
0.99830220713073
0.023769100169779286  # ratio

0.99830220713073
0.99830220713073
0.023769100169779286  # ratio

As you can see, Ratio is basically 0. Remove either of the UNIQUESTRING pieces 
and it goes up to 0.98 (correct)... Remove both and you get 1.0 (correct)


```
from difflib import SequenceMatcher

first = """
UNIQUESTRING
Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 
when an unknown printer took a galley of type and scrambled it to make a type 
specimen book. It has survived not only five centuries, but also the leap into 
electronic typesetting, remaining essentially unchanged. It was popularised in 
the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, 
and more recently with desktop publishing software like Aldus PageMaker 
including versions of Lorem Ipsum
"""


second = """

Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 
when an unknown printer took a galley of type and scrambled it to make a type 
specimen book. It has survived not only five centuries, but also the leap into 
electronic typesetting, remaining essentially unchanged. It was popularised in 
the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, 
and more recently with desktop publishing software like Aldus PageMaker 
including versions of Lorem Ipsum  UNIQUESTRING
"""

sm = SequenceMatcher(None, first, second, autojunk=False)
print(sm.real_quick_ratio())
print(sm.quick_ratio())
print(sm.ratio())

print()

sm2 = SequenceMatcher(None, second, first, autojunk=False)
print(sm2.real_quick_ratio())
print(sm2.quick_ratio())
print(sm2.ratio())

```

If I add `autojunk=False`, then I get a correct looking ratio (0.98...), 
however from my reading of the autojunk docs, UNIQUESTRING shouldn't be 
triggering it. Furthermore, looking in the code, as far as I can see autojunk 
is having no effect...

Autojunk considers these items to be "popular" in that string:
`{'n', 'p', 'a', 'h', 'e', 'u', 'I', 'r', 'k', 'g', 'y', 'm', 'c', 'd', 't', 
'l', 'o', 's', ' ', 'i'}`

If I remove UNIQUESTRING from `first`, this is the autojunk popular set:
`{'c', 'p', 'a', 'u', 'r', 'm', 'k', 'g', 'I', 'd', ' ', 'o', 'h', 't', 'e', 
'i', 'l', 's', 'y', 'n'}`

They're identical!

In both scenarios, `b2j` is also identical.

I don't pretend to understand what the module is doing in any detail, but this 
certainly seems like a false positive/negative.

Python 3.8.10

--
components: Library (Lib)
messages: 412673
nosy: jonathan-lp
priority: normal
severity: normal
status: open
title: SequenceMatcher & autojunk - false negative
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue46648] `test.test_urllib2.MiscTests.test_issue16464` flaky due to external connection

2022-02-06 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

The merged PRs disable the test without anything tracking fixing or 
re-re-enabling it.  Reopening & retitling this issue.

This specific test does not need to use an external server. That has nothing to 
do with what the purposes of the test is which is all around a content-length 
issue per https://bugs.python.org/issue16464

The appropriate fix is to have the test manage it's own http server on 
localhost in another thread or process.

We do not need to test it with https.

--
nosy: +gregory.p.smith
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open
title: `test.test_urllib2.MiscTests.test_issue16464` started to fail -> 
`test.test_urllib2.MiscTests.test_issue16464` flaky due to external connection
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



[issue46667] SequenceMatcher & autojunk - false negative

2022-02-06 Thread Jonathan


Jonathan  added the comment:

(Like the idiot I am, the example code is wrong. `autojunk` parameter should 
*not* be set for either of them to get the stated wrong results).

In place of "UNIQUESTRING", any unique 3 character string triggers it (QQQ, 
EEE, ZQU...). And in those cases you get a ratio of 0.008! (and 0.993 in the 
other direction!)

--

___
Python tracker 

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



[issue46667] SequenceMatcher & autojunk - false negative

2022-02-06 Thread Jonathan


Jonathan  added the comment:

Gah. I mean 0.008 in both directions. I'm just going to be quiet now. :-)

--

___
Python tracker 

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



[issue46654] urllib.request.urlopen doesn't handle UNC paths produced by pathlib's as_uri() (but can handle UNC paths with additional slashes)

2022-02-06 Thread Eryk Sun


Change by Eryk Sun :


--
assignee: docs@python -> 
components:  -2to3 (2.x to 3.x conversion tool), Argument Clinic, Build, C API, 
Cross-Build, Demos and Tools, Distutils, Documentation, Extension Modules, 
FreeBSD, IDLE, IO, Installation, Interpreter Core, Parser, Regular Expressions, 
SSL, Subinterpreters, Tests, Tkinter, Unicode, Windows, XML, asyncio, ctypes, 
email, macOS
stage:  -> needs patch
type: performance -> behavior
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue46667] SequenceMatcher & autojunk - false negative

2022-02-06 Thread Tim Peters


Tim Peters  added the comment:

SequenceMatcher looks for the longest _contiguous_ match. "UNIQUESTRING" isn't 
the longest by far when autojunk is False, but is the longest when autojunk is 
True. All those bpopular characters then effectively prevent finding a longer 
match than 'QUESTR' (capital 'I" is also in bpopular) directly.

The effects of autojunk can be surprising, and it would have been better if it 
were False by default. But I don't see anything unexpected here. Learn from 
experience and force it to False yourself ;-) BTW, it was introduced as a way 
to greatly speed comparing files of code, viewing them as sequences of lines. 
In that context, autojunk is rarely surprising and usually helpful. But it more 
often backfires when comparing strings (viewed as sequences of characters) :-(

--
nosy: +tim.peters

___
Python tracker 

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue46668] encodings: the "mbcs" alias doesn't work

2022-02-06 Thread STINNER Victor

New submission from STINNER Victor :

While working on bpo-46659, I found a bug in the encodings "mbcs" alias. Even 
if the function has 2 tests (in test_codecs and test_site), both tests missed 
the bug :-(

I fixed the alias with this change:
---
commit 04dd60e50cd3da48fd19cdab4c0e4cc600d6af30
Author: Victor Stinner 
Date:   Sun Feb 6 21:50:09 2022 +0100

bpo-46659: Update the test on the mbcs codec alias (GH-31168)

encodings registers the _alias_mbcs() codec search function before
the search_function() codec search function. Previously, the
_alias_mbcs() was never used.

Fix the test_codecs.test_mbcs_alias() test: use the current ANSI code
page, not a fake ANSI code page number.

Remove the test_site.test_aliasing_mbcs() test: the alias is now
implemented in the encodings module, no longer in the site module.
---

But Eryk found two bugs:

"""


This was never true before. With 1252 as my ANSI code page, I checked 
codecs.lookup('cp1252') in 2.7, 3.4, 3.5, 3.6, 3.9, and 3.10, and none of them 
return the "mbcs" encoding. It's not equivalent, and not supposed to be. The 
implementation of "cp1252" should be cross-platform, regardless of whether 
we're on a Windows system with 1252 as the ANSI code page, as opposed to a 
Windows system with some other ANSI code page, or a Linux or macOS system.

The differences are that "mbcs" maps every byte, whereas our code-page 
encodings do not map undefined bytes, and the "replace" handler of "mbcs" uses 
a best-fit mapping (e.g. "α" -> "a") when encoding text, instead of mapping all 
undefined characters to "?".
"""

and my new test fails if PYTHONUTF8=1 env var is set:

"""
This will fail if PYTHONUTF8 is set in the environment, because it overrides 
getpreferredencoding(False) and _get_locale_encoding().
"""

The code for the "mbcs" alias changed at lot between Python 3.5 and 3.7.

In Python 3.5, site module:
---
def aliasmbcs():
"""On Windows, some default encodings are not provided by Python,
while they are always available as "mbcs" in each locale. Make
them usable by aliasing to "mbcs" in such a case."""
if sys.platform == 'win32':
import _bootlocale, codecs
enc = _bootlocale.getpreferredencoding(False)
if enc.startswith('cp'):# "cp***" ?
try:
codecs.lookup(enc)
except LookupError:
import encodings
encodings._cache[enc] = encodings._unknown
encodings.aliases.aliases[enc] = 'mbcs'
---

In Python 3.6, encodings module:
---
(...)
codecs.register(search_function)

if sys.platform == 'win32':
def _alias_mbcs(encoding):
try:
import _bootlocale
if encoding == _bootlocale.getpreferredencoding(False):
import encodings.mbcs
return encodings.mbcs.getregentry()
except ImportError:
# Imports may fail while we are shutting down
pass

codecs.register(_alias_mbcs)
---

Python 3.7, encodings module:
---
(...)
codecs.register(search_function)

if sys.platform == 'win32':
def _alias_mbcs(encoding):
try:
import _winapi
ansi_code_page = "cp%s" % _winapi.GetACP()
if encoding == ansi_code_page:
import encodings.mbcs
return encodings.mbcs.getregentry()
except ImportError:
# Imports may fail while we are shutting down
pass

codecs.register(_alias_mbcs)
---

The Python 3.6 and 3.7 "codecs.register(_alias_mbcs)" doesn't work because 
"search_function()" is tested before and it works for "cpXXX" encodings. My 
changes changes the order in which codecs search functions are registered: 
first the MBCS alias, then the encodings search_function().

In Python 3.5, the alias was only created if Python didn't support the code 
page.

--
components: Library (Lib)
messages: 412678
nosy: vstinner
priority: normal
severity: normal
status: open
title: encodings: the "mbcs" alias doesn't work
versions: Python 3.11

___
Python tracker 

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



[issue46657] Add mimalloc memory allocator

2022-02-06 Thread Christian Heimes


Christian Heimes  added the comment:

We have an autoconf check for stdatomic.h. The test even verifies that a 
program with atomic_load_explicit() compiles and links.

How do we want to use mimalloc in the future? Is it going to stay optional in 
3.12? Then the default setting for --with-mimalloc should depend on presence of 
stdatomic.h. Do we want to make it mandatory for GC heap walking and nogil? 
Then --with-mimalloc should default to "yes" and configure should abort when 
stdatomic.h is missing.

I'm leaning towards --with-mimalloc=yes. It will make users aware that they 
need a compiler with atomics:

configure: error: --with-mimalloc requires stdatomic.h. Update your compiler or 
rebuild with --without-mimalloc. Python 3.12 will require stdatomic.

--

___
Python tracker 

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



[issue46668] encodings: the "mbcs" alias doesn't work

2022-02-06 Thread STINNER Victor

STINNER Victor  added the comment:

The alias was created in 2003 to fix bpo-671666:
---
commit 4eab486476c0082087a8460a5ab1064e64cc1a6b
Author: Martin v. Löwis 
Date:   Mon Mar 3 09:34:01 2003 +

Patch #671666: Alias ANSI code page to "mbcs".
---

In 2003, bpo-671666 was created because Python didn't support "cp932" encoding, 
whereas the MBCS codec was available and could used directly since cp932 was 
the ANSI code page.

The alias allows to support the ANSI code 932 without implement it.

But Python got a "cp932" codec the year after:
---
commit 3e2a30692085d32ac63f72b35da39158a471fc68
Author: Hye-Shik Chang 
Date:   Sat Jan 17 14:29:29 2004 +

Add CJK codecs support as discussed on python-dev. (SF #873597)

Several style fixes are suggested by Martin v. Loewis and
Marc-Andre Lemburg. Thanks!
---

--

___
Python tracker 

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



[issue46661] Duplicat deprecation warnings in docs for asyncio

2022-02-06 Thread Guido van Rossum


Guido van Rossum  added the comment:

Kumar are you interested in fixing this?

--

___
Python tracker 

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



[issue46669] Add types.Self

2022-02-06 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Typeshed now has a nice self-describing type variable to annotate context 
managers:

Self = TypeVar('Self')

def __enter__(self: Self) -> Self:
return self

It would be nice to have that in the standard library types module as well.

--
messages: 412682
nosy: Jelle Zijlstra, gvanrossum, rhettinger
priority: normal
severity: normal
status: open
title: Add types.Self
versions: Python 3.11

___
Python tracker 

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



[issue46668] encodings: the "mbcs" alias doesn't work

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:

Python 3.11 supports the 40 code pages:

* 037
* 273
* 424
* 437
* 500
* 720
* 737
* 775
* 850
* 852
* 855
* 856
* 857
* 858
* 860
* 861
* 862
* 863
* 864
* 865
* 866
* 869
* 874
* 875
* 932
* 949
* 950
* 1006
* 1026
* 1125
* 1140
* 1250
* 1251
* 1252
* 1253
* 1254
* 1255
* 1256
* 1257
* 1258

--

___
Python tracker 

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



[issue46669] Add types.Self

2022-02-06 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

PEP 673 (which was accepted) adds typing.Self already. bpo-46534 tracks 
implementing it.

--

___
Python tracker 

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



[issue46655] typing.TypeAlias is not in the list of allowed plain _SpecialForm typeforms

2022-02-06 Thread Guido van Rossum


Guido van Rossum  added the comment:

Looks like the more likely use case would be PEP 563:

from __future__ import annotations
from typing import TypeAlias, get_type_hints

import typing

class C:
a: TypeAlias = int

print(get_type_hints(C))


This prints

Traceback (most recent call last):
  File "C:\Users\gvanrossum\cpython\t.py", line 9, in 
print(get_type_hints(C))
  File 
"C:\Users\gvanrossum\AppData\Local\Programs\Python\Python310\lib\typing.py", 
line 1808, in get_type_hints
value = _eval_type(value, base_globals, base_locals)
  File 
"C:\Users\gvanrossum\AppData\Local\Programs\Python\Python310\lib\typing.py", 
line 326, in _eval_type
return t._evaluate(globalns, localns, recursive_guard)
  File 
"C:\Users\gvanrossum\AppData\Local\Programs\Python\Python310\lib\typing.py", 
line 690, in _evaluate
type_ = _type_check(
  File 
"C:\Users\gvanrossum\AppData\Local\Programs\Python\Python310\lib\typing.py", 
line 171, in _type_check
raise TypeError(f"Plain {arg} is not valid as type argument")

--
nosy: +gvanrossum

___
Python tracker 

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



[issue46655] typing.TypeAlias is not in the list of allowed plain _SpecialForm typeforms

2022-02-06 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 77b025be4a4cd5a3bfc1b1af560cc57e8e956c98 by Gregory Beauregard in 
branch 'main':
bpo-46655: allow stringized TypeAlias with get_type_hints (GH-31156)
https://github.com/python/cpython/commit/77b025be4a4cd5a3bfc1b1af560cc57e8e956c98


--

___
Python tracker 

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



[issue46668] encodings: the "mbcs" alias doesn't work

2022-02-06 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor


STINNER Victor  added the comment:

> New changeset 04dd60e50cd3da48fd19cdab4c0e4cc600d6af30 by Victor Stinner in 
> branch 'main':
> bpo-46659: Update the test on the mbcs codec alias (GH-31168)

This change is not correct, I created bpo-46668 to fix it.

--

___
Python tracker 

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



[issue46648] `test.test_urllib2.MiscTests.test_issue16464` flaky due to external connection

2022-02-06 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue46655] typing.TypeAlias is not in the list of allowed plain _SpecialForm typeforms

2022-02-06 Thread Gregory Beauregard


Change by Gregory Beauregard :


--
pull_requests: +29346
pull_request: https://github.com/python/cpython/pull/31175

___
Python tracker 

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



  1   2   >