[issue30459] PyList_SET_ITEM could be safer

2020-05-06 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 5.0 -> 6.0
pull_requests: +19291
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19975

___
Python tracker 

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



[issue37247] swap distutils build_ext and build_py commands to allow proper SWIG extension installation

2020-05-06 Thread John Andersen


John Andersen  added the comment:

I haven't made much progress on the fix yet. But I have a workaround here: 
https://github.com/tpm2-software/tpm2-pytss/commit/9952e374b4d9b854aea12c667dd7d7ab4ad501a9

--

___
Python tracker 

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



[issue40542] path environment variable not created correctly

2020-05-06 Thread Eryk Sun


Eryk Sun  added the comment:

Prepending directories ahead of system directories in PATH affects programs 
that implement their own search, which includes shells such as cmd.exe that do 
so in order to support PATHEXT efficiently. That said, note that temporarily 
prepending to PATH in a particular environment is common. Consider an activated 
virtual environment or a developer command prompt.

Usually programs defer to a Windows API function when searching for a file. The 
API uses search paths from the runtime library functions RtlGetSearchPath, 
RtlGetExePath, and LdrGetDllPath.

With WINAPI SearchPathW, the default search path is from RtlGetSearchPath 
(undocumented). It includes the following directories in non-safe search mode 
(the default mode):

  1. %__APPDIR__%
  2. %__CD__%
  3. %SystemRoot%\System32
  4. %SystemRoot%\System
  5. %SystemRoot%
  6. %PATH%

and the following adjusted order in safe search mode:

  1. %__APPDIR__%
  3. %SystemRoot%\System32
  4. %SystemRoot%\System
  5. %SystemRoot%
  2. %__CD__%
  6. %PATH%

Safe search mode can be set via WINAPI 
SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE).

With WINAPI CreateProcessW, the search path is from RtlGetExePath 
(undocumented). This is similar to the result from RtlGetSearchPath, except, 
instead of supporting a safe search mode, RtlGetExePath allows excluding the 
current directory (%__CD__%) from the search path by setting the environment 
variable NoDefaultCurrentDirectoryInExePath.

With WINAPI LoadLibrary[Ex]W, the system uses the search path from 
LdrGetDllPath (undocumented). The default DLL search path at startup under 
normal circumstances is the same as the safe-mode result from RtlGetSearchPath 
-- except for special casing of known system DLLs and API sets.

--
nosy: +eryksun

___
Python tracker 

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



[issue36077] Inheritance dataclasses fields and default init statement

2020-05-06 Thread Laurie Opperman


Laurie Opperman  added the comment:

Daniel's suggestion (and my PR) introduce a mechanism that is as far as I know 
almost completely bakwards-compatible. The only issue is if people were wanting 
(and acting on) a TypeError to be raised on dataclass construction (which I 
would say is rare to non-existant), and is the issue raised by the original 
post.

--

___
Python tracker 

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



[issue40539] Docs - difflib.SequenceMatcher quick_ratio and real_quick_ratio improved docs

2020-05-06 Thread Tim Peters


Tim Peters  added the comment:

Thanks for the effort, but I'm rejecting this.  The language deliberately 
defines nothing about how these are calculated.  It defines how `.ratio()` is 
computed, but that's all.  An implementation is free to do whatever it likes 
for the "quick" versions, provided only they return upper bounds on `.ratio()`. 
 Indeed, it's perfectly fine if an implementation merely returns 1.0 for both, 
regardless of the arguments.

If an implementation is cleverer than that, great, that's fine too - but it 
would be actively counterproductive to constrain them to be no _more_ clever 
than the current implementations.

--
nosy: +tim.peters
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-05-06 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 3466922320d54a922cfe6d6d44e89e1cea4023ef by Dong-hee Na in branch 
'master':
bpo-1635741: Port errno module to multiphase initialization (GH-19923)
https://github.com/python/cpython/commit/3466922320d54a922cfe6d6d44e89e1cea4023ef


--

___
Python tracker 

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



[issue40397] Refactor typing._GenericAlias

2020-05-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset c1c7d8ead9eb214a6149a43e31a3213c52448877 by Serhiy Storchaka in 
branch 'master':
bpo-40397: Refactor typing._GenericAlias (GH-19719)
https://github.com/python/cpython/commit/c1c7d8ead9eb214a6149a43e31a3213c52448877


--

___
Python tracker 

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



[issue2716] Document license under which audioop is used

2020-05-06 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions: +Python 3.7, Python 3.8, Python 3.9 -Python 2.7, Python 3.4, Python 
3.5

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-05-06 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
pull_requests: +19290
pull_request: https://github.com/python/cpython/pull/19973

___
Python tracker 

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



[issue2716] Document license under which audioop is used

2020-05-06 Thread Furkan Onder


Change by Furkan Onder :


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

___
Python tracker 

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



[issue40462] [easy] undefined name in Lib/test/mock_socket.py

2020-05-06 Thread Furkan Onder


Change by Furkan Onder :


--
pull_requests: +19288
pull_request: https://github.com/python/cpython/pull/19972

___
Python tracker 

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



[issue2716] Document license under which audioop is used

2020-05-06 Thread Furkan Onder


Furkan Onder  added the comment:

PR has been sent.

--
nosy: +furkanonder

___
Python tracker 

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



[issue36077] Inheritance dataclasses fields and default init statement

2020-05-06 Thread Eric V. Smith


Eric V. Smith  added the comment:

It would be good if there were some way of unifying existing usage with 
positional-only and keyword-only parameters, and also supporting inheritance 
for dataclasses that use these features at various points in the hierarchy. I 
don't have any big ideas about this.

And of course it all needs to be backward compatible.

--

___
Python tracker 

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



[issue40494] collections.abc.Callable and type variables

2020-05-06 Thread Guido van Rossum


Guido van Rossum  added the comment:

Hm, I am indeed torn. ISTM a subclass just for Callable is slightly better.

--

___
Python tracker 

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



[issue40542] path environment variable not created correctly

2020-05-06 Thread Ned Deily


Change by Ned Deily :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue40517] Syntax highlighting for ASDL

2020-05-06 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> I tried both a laptop and desktop and slightly prefer unbolded.  How about a 
> darker blue?

Sorry but I have no control over styles. They are pre-defined, I only change 
the token type and pygments handles the rest of it. I dont know if such a color 
exists.

--

___
Python tracker 

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



[issue40542] path environment variable not created correctly

2020-05-06 Thread Roman


New submission from Roman :

The Python 3.8 for Windows installer has an option to add the install folder to 
the path environment variable. It adds the path to the front of the list so 
that it is the first item. According to my understanding, this is bad behavior. 
It should add new path items to the end of the list because Windows searches in 
order. c:\windows\system32 should remain the first item in the list. This is a 
classic mistake of installers.

--
components: Installation
messages: 368312
nosy: Roman
priority: normal
severity: normal
status: open
title: path environment variable not created correctly
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



[issue40517] Syntax highlighting for ASDL

2020-05-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I tried both a laptop and desktop and slightly prefer unbolded.  How about a 
darker blue?

--

___
Python tracker 

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



[issue40512] Meta issue: per-interpreter GIL

2020-05-06 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-39465: "Design a subinterpreter friendly alternative to 
_Py_IDENTIFIER". Currently, this C API is not compatible with subinterpreters.

--

___
Python tracker 

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



[issue40539] Docs - difflib.SequenceMatcher quick_ratio and real_quick_ratio improved docs

2020-05-06 Thread Lewis Ball


Change by Lewis Ball :


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

___
Python tracker 

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



[issue5879] multiprocessing example "pool of http servers " fails on windows

2020-05-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

As I said above, the example was removed from 3.x.  At some point, they were 
all vetted for Windows execution or failure.

Zach, thanks for reviewing 2.7 issues.

--
resolution:  -> out of date
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue25707] Add the close method for ElementTree.iterparse() object

2020-05-06 Thread Furkan Onder


Furkan Onder  added the comment:

Python 3.8.2 (default, Apr  8 2020, 14:31:25) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.etree.ElementTree as ET
>>> import gc
>>> ET.iterparse('/dev/null')
.IterParseIterator object at 
0x7fb96f679d00>
>>> gc.collect()
34

The warning(__main__:1: ResourceWarning: unclosed file <_io.BufferedReader 
name='/dev/null'>) is no longer available in python3.8.2

--
nosy: +furkanonder

___
Python tracker 

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



[issue40541] Add optional weights parameter to random.sample()

2020-05-06 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue40541] Add optional weights parameter to random.sample()

2020-05-06 Thread Raymond Hettinger


New submission from Raymond Hettinger :

I've seen multiple requests for this and it isn't obvious how to do it with the 
existing tooling.  

The example currently given in the recipes section isn't scalable because it 
involves expanding the population into a big list with repeated elements:

  sample(['x', 'x', 'x', 'x', 'y', 'y', 'z'], k=5)

Example task:  Given an urn with 8 red balls, 2 white balls, and 3 green balls, 
choose ten without replacement:

>>> population = ['red', 'blue', 'green']
>>> weights =[  8,  5,  3   ]
>>> sample(population, weights=weights, k=10)
['red', 'green', 'blue', 'red', 'green', 'blue', 'red', 'blue', 'red', 
'blue']

I could also add *cum_weights* as an optional optimization but think it best to 
wait until someone asks for it ;-)

--
components: Library (Lib)
messages: 368307
nosy: rhettinger, tim.peters
priority: normal
severity: normal
status: open
title: Add optional weights parameter to random.sample()
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



[issue40540] inconstent stdin buffering/seeking behaviour

2020-05-06 Thread Peter Law


New submission from Peter Law :

`sys.stdin` (on Windows, tested Pythons 3.6-3.8) appears to have different 
seeking behaviour depending on the source of the incoming data. This seems 
arguably reasonable given that `stdin` isn't always seekable, however even in 
the failing case `sys.stdin.seekable()` returns `True`.

Given the `reader.py` source:

``` python
import sys


def coding_check(lines, default='utf-8'):
for line_number, line in enumerate(lines, 1):
print((line_number, line))
if line_number > 2:
break
return default


stdin = sys.stdin
print(stdin.seekable())

stdin.seek(0)

coding_check(stdin)

stdin.seek(0)
print(stdin.read())
```

then for two similar invocations we get differing results:

```
> python reader.py < reader.py
True
(1, 'import sys\n')
(2, '\n')
(3, '\n')
import sys


def coding_check(lines, default='utf-8'):

<... etc. redacted for brevity>

>
```

```
> type reader.py | python reader.py
True
(1, 'import sys\n')
(2, '\n')
(3, '\n')

>
```

I realise that raw standard input isn't always seekable, however I would hope 
that in the case that it isn't seekable that `.seekable()` would tell us that.

I also tried wrapping `stdin.buffer` in an `io.BufferedReader` and using that, 
however for short files (three lines or less) this issue is still present. I'm 
not sure if this is something I'm misunderstanding around buffered readers, a 
variation on this issue or another issue though.

--
components: Windows
messages: 368306
nosy: PeterJCLaw, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: inconstent stdin buffering/seeking behaviour
type: behavior

___
Python tracker 

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



[issue40539] Docs - difflib.SequenceMatcher quick_ratio and real_quick_ratio improved docs

2020-05-06 Thread Lewis Ball


New submission from Lewis Ball :

Currently the docs for `difflib.SequenceMatcher.quick_ratio()` just says 
'Return an upper bound on ratio() relatively quickly', which doesn't give much 
of an idea about how that upper bound is calculated. `real_quick_ratio` has 
similarly brief documentation.

I'll raise a PR shortly to add a more verbose description to each of these 
ratios, so that it is clear when each should be used.

My current suggestions would be:

quick_ratio
Return an upper bound on ratio() relatively quickly. This is the highest 
possible ratio() given these letters, regardless of their order.

real_quick_ratio
Return an upper bound on ratio() very quickly. This is the highest possible 
ratio() given the lengths of a and b, regardless of their letters. i.e. 
2*(min(len(a), len(b))/(len(a) + len(b))

--
assignee: docs@python
components: Documentation
messages: 368305
nosy: Lewis Ball, docs@python
priority: normal
severity: normal
status: open
title: Docs - difflib.SequenceMatcher quick_ratio and real_quick_ratio improved 
docs
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



[issue40334] PEP 617: new PEG-based parser

2020-05-06 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 470aac4d8e76556bd8f820f3f3928dca2b4d2849 by Pablo Galindo in 
branch 'master':
bpo-40334: Generate comments in the parser code to improve debugging (GH-19966)
https://github.com/python/cpython/commit/470aac4d8e76556bd8f820f3f3928dca2b4d2849


--

___
Python tracker 

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



[issue40517] Syntax highlighting for ASDL

2020-05-06 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Attaching 2 different styles python_bold.png (module  is bold) and 
asdl_no_style.png (module  has no style)

--
Added file: https://bugs.python.org/file49135/python_bold.png

___
Python tracker 

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



[issue40517] Syntax highlighting for ASDL

2020-05-06 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


Added file: https://bugs.python.org/file49136/asdl_no_style.png

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-05-06 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 99db2a1db7a9b468a0ce8377d579f78fa03a2a34 by Pablo Galindo in 
branch 'master':
bpo-40334: Allow trailing comma in parenthesised context managers (GH-19964)
https://github.com/python/cpython/commit/99db2a1db7a9b468a0ce8377d579f78fa03a2a34


--

___
Python tracker 

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



[issue40517] Syntax highlighting for ASDL

2020-05-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I don't like the red Python in asdl2.  Just black, perhaps bold, would be 
better.  Also I like the darker blue in asdl.py, bold or not.  Better contrast 
to me from the greens.  But I agree that grape is too clashy.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue18857] urlencode of a None value uses the string 'None'

2020-05-06 Thread James Addison


James Addison  added the comment:

The pair of pull requests below implement None-preserving urlencode and 
parse_qs* via a default-disabled flag 'standalone_keys'.

- https://bugs.python.org/pull_request19259
- https://bugs.python.org/pull_request19264

(they're also already linked with this issue, thanks to the neat GitHub/BPO 
integration)

A benefit of the proposed serialization changes is that developers can opt-in 
to a scheme in which "{'a': None}" and "{'a': ''}" do not collide to the same 
encoded representation.

Would it be possible to re-open this issue for discussion?

--

___
Python tracker 

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



[issue40538] struct.calcsize('L')== 8 but 4 is specified in documentation

2020-05-06 Thread Mark Dickinson


New submission from Mark Dickinson :

Use `struct.calcsize('L')` if you want the standard 
sizes and formats given in the documentation. The note at the top of the struct 
module documentation describes the difference.

See also #1709506.

--
nosy: +mark.dickinson
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



[issue40334] PEP 617: new PEG-based parser

2020-05-06 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +19285
pull_request: https://github.com/python/cpython/pull/19969

___
Python tracker 

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



[issue40538] struct.calcsize('L')== 8 but 4 is specified in documentation

2020-05-06 Thread Jo King


Change by Jo King :


--
nosy: JoKing
priority: normal
severity: normal
status: open
title: struct.calcsize('L')== 8 but 4 is specified in documentation
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue40028] Math module method to find prime factors for non-negative int n

2020-05-06 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

For some more ideas for features or APIs, you could look at: 
https://docs.sympy.org/latest/modules/ntheory.html or 
http://doc.sagemath.org/html/en/reference/rings_standard/sage/arith/misc.html 
for an absolute upper bound.

If there's to be a minimal number theory (imath?) module, I would interested in 
what's below. I'm a math student so perhaps my workload is perhaps not 
representative of most people (and I can turn to tools like SageMath for most 
of this), but nonetheless here would be my wishlist for the stdlib.

- prime_factors(n): iterator or tuple of prime factors in multiplicity
- factorization(n): like collections.Counter(prime_factors(n))
- divisors(n): iterator for divisors based on factorization
- is_prime(n, bases=20): do some randomized Miller-Rabin
- crt(moduli, values): Chinese Remainder Theorem
- xgcd(numbers) -> tuple[int, tuple[int]]: use the extended euclidean algorithm 
to find gcd and Bezout coefficients
- generate_primes(start=2)
- next_prime(n) / prev_prime(n)
- prime_range(a, b)
- is_square(n) (maybe is_nth_power?)
- multiplicity(p, n): maximal r such that p**r divides n
- is_quadratic_residue(a, modulus)
- primitive_root(modulus)
- multinomial(n, *ks)

Already in math module:
- gcd and lcm 
- comb(n, k)
- perm(n, k)
- isqrt(n)
- factorial(n)

Looking at this list though, I realize that there is infinite potential for 
feature-creep, and so it would be nice to have an explicit set of guidelines 
for what sorts of functions are allowed. Perhaps something like "must have a 
common-enough use case outside of pure math". There's also a limitless amount 
of micro-optimization that can come with several of these (is_prime, is_square, 
generate_primes, etc.), so it might be nice to have a guideline about only 
accepting performace optimizations if the cost in complexity is small.

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue40517] Syntax highlighting for ASDL

2020-05-06 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

(by the way, I did not push this change. I'll push it when you think it is 
ready)

--

___
Python tracker 

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



[issue40537] Typo in Doc/library/sqlite3.rst

2020-05-06 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


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



[issue40501] Deprecate and remove ctypes usage in uuid

2020-05-06 Thread Steve Dower


Steve Dower  added the comment:

Thanks Ned.

There are some platform.version() checks in there that I'm basically ignoring 
right now - are those unnecessary? Shall I clean them up too?

--

___
Python tracker 

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



[issue40537] Typo in Doc/library/sqlite3.rst

2020-05-06 Thread Naglis Jonaitis


Change by Naglis Jonaitis :


--
keywords: +patch
nosy: +naglis
nosy_count: 2.0 -> 3.0
pull_requests: +19284
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19965

___
Python tracker 

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



[issue40537] Typo in Doc/library/sqlite3.rst

2020-05-06 Thread Joannah Nanjekye


New submission from Joannah Nanjekye :

>From this:

Now you want to store the point in a single SQLite column.  First you'll have to
choose one of the supported types first to be used for representing the point.

First looks repeated.

--
assignee: docs@python
components: Documentation
messages: 368295
nosy: docs@python, nanjekyejoannah
priority: normal
severity: normal
status: open
title: Typo in  Doc/library/sqlite3.rst
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



[issue40517] Syntax highlighting for ASDL

2020-05-06 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Unfortunately there aren't many `bold` type tokens I can use, so I had to 
change color of module . If you wish I can make both class names and 
`Python` bold, or keep it in this way.

--
Added file: https://bugs.python.org/file49134/asdl2.png

___
Python tracker 

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



[issue36284] importlib.import_module() not thread safe if Exception is raised (3.4, 3.5)

2020-05-06 Thread Brett Cannon


Brett Cannon  added the comment:

@Patrick you will have to open a new issue and be very specific about what the 
problem is with a reproducible code snippet to show how the current fix is 
wrong (I also don't know how upgrading Django comes into play since this is not 
Django's issue tracker).

--

___
Python tracker 

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



[issue40528] Improve / Clear ASDL generator

2020-05-06 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


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

___
Python tracker 

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



[issue40517] Syntax highlighting for ASDL

2020-05-06 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The new screenshot looks nice.  The colors are much better.  Can you post 
another run with the class names in bold.

--

___
Python tracker 

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



[issue40517] Syntax highlighting for ASDL

2020-05-06 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
pull_requests: +19282
pull_request: https://github.com/python/cpython/pull/19967

___
Python tracker 

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



[issue40517] Syntax highlighting for ASDL

2020-05-06 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Hey Raymond, can you give me your feedback on asdl.png (the screenshot of new 
theme)?

--
Added file: https://bugs.python.org/file49133/asdl.png

___
Python tracker 

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



[issue40283] Documentation of turtle.circle()

2020-05-06 Thread Cajetan Rodrigues


Cajetan Rodrigues  added the comment:

When I checked, I found the following:

turtle.circle(50, 50)   # counter-clockwise
turtle.circle(-50, -50) # counter-clockwise
turtle.circle(-50, 50)  # clockwise
turtle.circle(50, -50)  # clockwise

So it seems both radius and extent need to be of the same signage to effect a 
counter-clockwise draw. However, for the 2 cases where extent is negative, the 
draw happens through the turtle's tail rather than the head. Looks weird.

--
nosy: +cajetan.rodrigues

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-05-06 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +19281
pull_request: https://github.com/python/cpython/pull/19966

___
Python tracker 

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



[issue40506] add support for os.Pathlike filenames in zipfile.ZipFile.writestr

2020-05-06 Thread Domenico Ragusa

Domenico Ragusa  added the comment:

Here's a small patch to do this. Everything seems to work fine.
I don't know if where I placed the test (in OtherTests) is the most appropriate.

On Tue, May 5, 2020 at 4:12 AM Domenico Ragusa  wrote:
>
>
> New submission from Domenico Ragusa :
>
> ZipFile seems to support Pathlike objects pretty well, except in 
> ZipFile.writestr.
> For example:
>
> >>> a = ZipFile(Path('test.zip'), 'w') # this works ok
> >>> a.write(Path('./foo.jpeg'), arcname=PurePath('/some/thing.jpeg')) # this 
> >>> works as well
> >>> a.writestr(PurePath('/test.txt'), 'idk') # this doesn't
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python3.8/zipfile.py", line 1788, in writestr
> zinfo = ZipInfo(filename=zinfo_or_arcname,
>   File "/usr/lib/python3.8/zipfile.py", line 349, in __init__
> null_byte = filename.find(chr(0))
> AttributeError: 'PurePosixPath' object has no attribute 'find'
>
> I think it would be more consistent if it accepted any kind of paths, it 
> would suffice to call os.fspath in ZipInfo.__init__ when the filename is a 
> Pathlike-object, it's just 2 lines (+ tests, of course).
>
> Can I go ahead and prepare a patch for this?
>
> --
> components: Library (Lib)
> messages: 368098
> nosy: d.ragusa
> priority: normal
> severity: normal
> status: open
> title: add support for os.Pathlike filenames in zipfile.ZipFile.writestr
> type: enhancement
> versions: Python 3.9
>
> ___
> Python tracker 
> 
> ___

--
keywords: +patch
Added file: https://bugs.python.org/file49132/pathlike_writestr.patch

___
Python tracker 

___diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 29d98c8092..31c83987ab 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -1546,6 +1546,12 @@ class OtherTests(unittest.TestCase):
 zinfo.flag_bits |= 0x08  # Include an extended local header.
 orig_zip.writestr(zinfo, data)
 
+def test_writestr_pathlike_issue40506(self):
+with zipfile.ZipFile(TESTFN2, 'w') as orig_zip:
+path = '/foo/bar.txt'
+orig_zip.writestr(pathlib.PurePath(path), '1234')
+self.assertEqual(orig_zip.open(path).read(4), b'1234')
+
 def test_close(self):
 """Check that the zipfile is closed after the 'with' block."""
 with zipfile.ZipFile(TESTFN2, "w") as zipfp:
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 8903d6a42e..44b3ee8e63 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -341,6 +341,8 @@ class ZipInfo (object):
 )
 
 def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)):
+if isinstance(filename, os.PathLike):
+filename = os.fspath(filename)
 self.orig_filename = filename   # Original file name in archive
 
 # Terminate the file name at the first null byte.  Null bytes in file
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40334] PEP 617: new PEG-based parser

2020-05-06 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 999ec9ab6af536cc2666a0847ec02331aaf00416 by Lysandros Nikolaou in 
branch 'master':
bpo-40334: Add type to the assignment rule in the grammar file (GH-19963)
https://github.com/python/cpython/commit/999ec9ab6af536cc2666a0847ec02331aaf00416


--

___
Python tracker 

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



[issue40526] documentation bad on asyncio

2020-05-06 Thread Yury Selivanov


Yury Selivanov  added the comment:

> If so, the main purpose of that example is just to demonstrate basic 
> async/await syntax, and show asyncio.run() for a trivial case to clearly show 
> how it's used at a fundamental level; it's intentional that the more involved 
> examples that demonstrate asynchronous programming are contained in 
> https://docs.python.org/3/library/asyncio-task.html#coroutine. Also, the 
> example is simple and condensed enough that it requires zero additional 
> explanation or context, as should be the case for a simple "hello world" 
> example. Consider the perspective of someone who found the page without 
> having previously seen async/await syntax used.

Yes, exactly.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-05-06 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +19280
pull_request: https://github.com/python/cpython/pull/19964

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-05-06 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
pull_requests: +19279
pull_request: https://github.com/python/cpython/pull/19963

___
Python tracker 

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



[issue40028] Math module method to find prime factors for non-negative int n

2020-05-06 Thread Mark Dickinson


Mark Dickinson  added the comment:

Some of the things that might go into a PEP, or into the PEP-creation process:

- Arguments for:

  (a) a new imath module, versus
  (b) new functions in math, versus
  (c) a 3rd party package on PyPI.

- A handful of plausible use-cases.

- Comparisons with what other languages provide.

- Discussion of how to handle existing integer math functions (gcd, factorial, 
isqrt, comb, perm, ...). If we had an imath module, users would probably expect 
to find many of these in that imath rather than in math. Do we re-export these 
functions in imath? If so, do we live with the duplication indefinitely, or aim 
for eventual deprecation and removal of the math module functions? Over what 
time period would such deprecation happen? Or do we leave everything where it 
is and simply add a "see also" documentation note to the imath documentation 
directing users to those math module functions?

- Outline of the minimal coherent set of things that we want to implement.
  - Q: do we want "primes_below / small_primes" _and_ a lazy prime generator, 
or just one? Which one?
  - Q: do we need nextprime and prevprime?
  - Q: do we want a deterministic prime test in addition to a probable prime 
test (however slow that may be)?
  - Q: do we need random prime (or probable prime) generation?

- Proposed APIs for each of those things (mostly straightforward, but not 
entirely so). There are lots of potentially contentious details here, like how 
to handle factorization of non-positive integers, the format for the 
factorization output (pairs of (prime, exponent)? repeated primes? guaranteed 
sorted?), etc.; we've already discussed the fun involved in probabilistic prime 
testing.

- The inevitable bikeshedding on names. factorize? factorise? factor? 
factorint? nextprime? next_prime?

I'd also like to have set out some kind of coherent set of goals / design 
decisions for the module that will help us make decisions in the future about 
whether a particular proposed shiny new thing should be included or not, 
whether it belongs in math or in imath, and that for new things in imath would 
help guide the API for that new thing. Are we aiming for a basic set of 
building blocks, or something more complete? Are we thinking about security 
concerns (adversarial attacks on probabilistic prime testing), or are those out 
of scope?

Algorithmic details (as opposed to API) should mostly be out of scope for the 
PEP, but there'll be plenty to discuss if/when we get to implementation stage. 
(For factorization, I think we'll need to say _something_, so that users can 
have reasonable expectations about what size of composite can be factorised in 
a reasonable amount of time.)

--

___
Python tracker 

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



[issue40536] Addition of a "list of available time zones" function to zoneinfo

2020-05-06 Thread Paul Ganssle

New submission from Paul Ganssle :

One thing that I sort of overlooked in PEP 615 that I think will be a common 
feature request for zoneinfo is the ability to get a list of time zones 
available on the current TZPATH.

This is more complicated to implement than it sounds like, but luckily I 
already did it in order to implement the property tests for the zoneinfo module:

https://github.com/pganssle/zoneinfo/blob/ffd21a6d065e04725e04b37bb430c2559fefd5fa/tests/test_zoneinfo_property.py#L23-L70

The biggest complication is that there are files on TZPATH that are not 
necessarily time zones, and when I looked I couldn't easily find a list of all 
available time zones, so the only way to tell which ones are time zones and 
which ones aren't is to open each one and read the first 4 bytes. However, 
`tzdata` does ship with a list of available time zones, so the way I've got the 
function working right now is:

1. If `tzdata` is installed – despite the fact that it's technically the end of 
the search path, convert the list of available zones that ships with `tzdata` 
to your starting set (since you know these are all valid zones).
2. Walk the `tzpath`, and every time you find something not in the set of valid 
keys, open it and read the first 4 bytes, then add that to the set.

The common cases will be that `tzdata` is not available (in which case no harm 
done), or `tzdata` has the same set of keys as the TZPATH, in which case you 
never have to open any of the TZif files. The fact that the search order is 
inverted from what it normally is doesn't matter because the output is the 
union of all the sets anyway.

I don't know that the PEP needs to be amended – if this were a feature request 
for Python 3.10 I don't think it would need a PEP to go through, but I don't 
mind amending the PEP to document it.

Design decisions (with my initial answers, loosely held):

1. Should this be a classmethod or a free-standing function?

I'm inclined towards free-standing function because zoneinfo.TZPATH is at the 
module level and not the class level.

2. What should the return type be?

I think frozenset() or set(); a sorted list is also a reasonable option, but 
for people who just want to use "in" or show some subset of available zones, 
that would be wasteful.

We should go with frozenset() if we want there to be some possibility of 
caching the result in the future.

3. Should we try to cache the result?

I would say no, at least for now. It would not be super easy to get the cache 
invalidation right in the general case, and not many people are likely to be 
sensitive to the performance of this operation – the people who are can easily 
create their own cache.

4. What should it be called?

Naming things is hard. Options:

- zoneinfo.timezones()
- zoneinfo.all_timezones()
- zoneinfo.timezone_{list,set}()
- zoneinfo.valid_timezones()
- zoneinfo.valid_keys()
- zoneinfo.available_timezones()

`pytz` has a similar thing and calls it all_timezones. It also has something 
called common_timezones, but that is a bit harder to pull off and I'm not 
confident that we'll get something satisfactory before the feature freeze.

--
components: Library (Lib)
messages: 368285
nosy: belopolsky, lemburg, p-ganssle
priority: normal
severity: normal
status: open
title: Addition of a "list of available time zones" function to zoneinfo
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



[issue40509] In argparse, allow REMAINDER(...) arguments in a mutually exclusive group

2020-05-06 Thread Shani Armon


Shani Armon  added the comment:

Yes. The pull request contains the special handling. For the purpose of 
REMAINDER positionals, the default is changed to the empty list that was 
returned if no arguments were passed. 

For the purpose of positional argument, that is equivalent to nothing being 
passed

--

___
Python tracker 

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



[issue40521] Make tuple, dict, frame free lists, unicode interned strings, unicode latin1 singletons per-interpreter

2020-05-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b7aa23d29fa48238dab3692d02e1f0a7e8a5af9c by Victor Stinner in 
branch 'master':
bpo-40521: Disable list free list in subinterpreters (GH-19959)
https://github.com/python/cpython/commit/b7aa23d29fa48238dab3692d02e1f0a7e8a5af9c


--

___
Python tracker 

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



[issue40509] In argparse, allow REMAINDER(...) arguments in a mutually exclusive group

2020-05-06 Thread paul j3


paul j3  added the comment:

A flagged argument with REMAINDER works just fine in a mutually exclusive group.

group.add_argument('-g', nargs='...')

positionals in such a group can only have ? or *.  If you check the code, and 
past issues you'll see that those require some special handling.  Normally that 
kind of positional is always 'seen', because an empty list (not strings) 
satisfies those nargs. One positional can work in a mutually exclusive group 
because it's been made to work, not because the fit is natural.

Search past issues for REMAINDER to check whether your concerns have been 
raised before.   If I recall correctly, even without a group, handling a 
flagged argument with REMAINDER is more robust than a positional.

--

___
Python tracker 

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



[issue5879] multiprocessing example "pool of http servers " fails on windows

2020-05-06 Thread Zackery Spytz


Zackery Spytz  added the comment:

Python 2 is EOL.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-06 Thread STINNER Victor


STINNER Victor  added the comment:

> we may want to consider skipping `test_close_kill_running` for 
> `MultiLoopWatcher` until we can find one

There are more MultiLoopWatcher tests which hang randomly, it's not only 
test_close_kill_running().

I'm fine with skipping tests until someone can come up with a fix.

--

___
Python tracker 

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



[issue40533] Subinterpreters: don't share Python objects between interpreters

2020-05-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d8135e913ab7c694db247c86d0a84c450c32d86e by Victor Stinner in 
branch 'master':
bpo-40533: Disable GC in subinterpreters (GH-19961)
https://github.com/python/cpython/commit/d8135e913ab7c694db247c86d0a84c450c32d86e


--

___
Python tracker 

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



[issue40521] Make tuple, dict, frame free lists, unicode interned strings, unicode latin1 singletons per-interpreter

2020-05-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 89fc4a34cf7a01df9dd269d32d3706c68a72d130 by Victor Stinner in 
branch 'master':
bpo-40521: Disable method cache in subinterpreters (GH-19960)
https://github.com/python/cpython/commit/89fc4a34cf7a01df9dd269d32d3706c68a72d130


--

___
Python tracker 

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



[issue40535] While build python 3.8.2 in linux ctypes.so is using libffi.so.6 instead of libffi.so.7

2020-05-06 Thread Ajaya


New submission from Ajaya :

i am using libffi-3.3.tgz for building python 3.8.2 in Linux. In windows there 
is no problem it is using libffi-7.dll.In linux it is using libffi.so.6 instead 
of libffi.so.7.
i am using "./configure --prefix=/u/$loginID/Python$pythonVersion 
--enable-debug".

--
components: Build
messages: 368277
nosy: Ajaya
priority: normal
severity: normal
status: open
title: While build python 3.8.2 in linux  ctypes.so is using libffi.so.6 
instead of libffi.so.7
type: compile error
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



[issue40533] Subinterpreters: don't share Python objects between interpreters

2020-05-06 Thread STINNER Victor


STINNER Victor  added the comment:

> Yep, before per-interpreter GIL is official we must get to the point where 
> *no* PyObject objects are shared.

I would like to add: "no PyObject objects are shared in the stdlib" ;-)

--

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-05-06 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
pull_requests: +19278
pull_request: https://github.com/python/cpython/pull/19962

___
Python tracker 

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



[issue40527] Multiple "unknown option" errors when passing unknown arguments to the interpreter

2020-05-06 Thread STINNER Victor


STINNER Victor  added the comment:

> That was an insanely fast fix - thanks everyone! :)

Sorry about that. We are working on this issue to ensure that next bugs will 
not fixed as quickly a this done ;-)

--

___
Python tracker 

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



[issue40533] Subinterpreters: don't share Python objects between interpreters

2020-05-06 Thread Eric Snow


Eric Snow  added the comment:

Yep, before per-interpreter GIL is official we must get to the point where *no* 
PyObject objects are shared.

Making PyObject.ob_refcnt atomic until then (only as part of the experiment) 
should be fine.

--

___
Python tracker 

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



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-05-06 Thread Eric Snow


Eric Snow  added the comment:

FYI, with the following additions in Lib/test/test_datetime.py...

   before = set(sys.modules)
   try:
   pure_tests = import_fresh_module(TESTS, fresh=['datetime', '_strptime'],
 blocked=['_datetime'])
   _pure = set(sys.modules)
   fast_tests = import_fresh_module(TESTS, fresh=['datetime',
  '_datetime', '_strptime'])
   _fast = set(sys.modules)
   print(f'added (pure): {sorted(_pure-before)}')
   print(f'added (fast): {sorted(_fast-before)}')
   print('---')
   finally:
  ...

I get the following output running "./python -m test test_datetime 
test_datetime":

   0:00:00 load avg: 0.52 Run tests sequentially
   0:00:00 load avg: 0.52 [1/2] test_datetime
   added (pure): ['_decimal', '_strptime', '_testcapi', 'decimal', 'numbers', 
'test.datetimetester']
   added (fast): ['_decimal', '_strptime', '_testcapi', 'decimal', 'numbers', 
'test.datetimetester']
   ---
   0:00:05 load avg: 0.52 [2/2] test_datetime
   added (pure): ['_datetime', '_strptime', 'datetime']
   added (fast): ['_datetime', '_strptime', 'datetime']
   ---
   [snipped]

That definitely tells a story. :)  Unfortunately, for now I don't have any more 
time to investigate.  Sorry.

--
nosy: +eric.snow

___
Python tracker 

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



[issue40512] Meta issue: per-interpreter GIL

2020-05-06 Thread STINNER Victor


STINNER Victor  added the comment:

I created bpo-40533: "Subinterpreters: don't share Python objects between 
interpreters".

--

___
Python tracker 

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



[issue40533] Subinterpreters: don't share Python objects between interpreters

2020-05-06 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +eric.snow

___
Python tracker 

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



[issue40533] Subinterpreters: don't share Python objects between interpreters

2020-05-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19277
pull_request: https://github.com/python/cpython/pull/19961

___
Python tracker 

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



[issue40521] Make tuple, dict, frame free lists, unicode interned strings, unicode latin1 singletons per-interpreter

2020-05-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19276
pull_request: https://github.com/python/cpython/pull/19960

___
Python tracker 

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



[issue40531] Adding the method find() to list

2020-05-06 Thread João Marcos

João Marcos  added the comment:

Thanks for the replies!.

Here's the link for discussion in the Python Ideas:
https://discuss.python.org/t/adding-the-method-find-to-list/4113

--

___
Python tracker 

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



[issue40534] ShUtil doc deficiencies

2020-05-06 Thread T UA


Change by T UA :


--
type:  -> enhancement

___
Python tracker 

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



[issue40521] Make tuple, dict, frame free lists, unicode interned strings, unicode latin1 singletons per-interpreter

2020-05-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19275
pull_request: https://github.com/python/cpython/pull/19959

___
Python tracker 

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



[issue40534] ShUtil doc deficiencies

2020-05-06 Thread T UA


New submission from T UA :

https://docs.python.org/3/library/shutil.html

The operational outcome for the various copy functions is not described for the 
cases in which the target file already exists. Do they overwrite, do they raise 
exceptions and if so, which ones?

--
messages: 368270
nosy: T UA
priority: normal
severity: normal
status: open
title: ShUtil doc deficiencies

___
Python tracker 

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



[issue40529] Auto Completions with case insensitive

2020-05-06 Thread Madhusudhan Kasula


Madhusudhan Kasula  added the comment:

Yes. Python is case sensitive language and this feature will not break its 
essence.
This case insensitive completion will help interpreter user for easy typing and 
choose from the available options.
In the following example even user typed 'os.po', completions will give user 
all the options ignoring case:

>>>  os.po
os.POSIX_FADV_DONTNEEDos.POSIX_FADV_NORMAL  os.POSIX_FADV_SEQUENTIAL  
os.popen( os.posix_fallocate(   
os.POSIX_FADV_NOREUSE os.POSIX_FADV_RANDOM  os.POSIX_FADV_WILLNEED
os.posix_fadvise( 
>>> os.po

And finally, this is implemented as an controllable user option with default 
value as 'case sensitive'. So user can choose to go case insensitive or not. 
Even core 'readline' also provide this option with 'set completion-ignore-case 
on'.

--

___
Python tracker 

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



[issue40533] Subinterpreters: don't share Python objects between interpreters

2020-05-06 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue38787] PEP 573: Module State Access from C Extension Methods

2020-05-06 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue40533] Subinterpreters: don't share Python objects between interpreters

2020-05-06 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue40531] Adding the method find() to list

2020-05-06 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Please take this to Python ideas.  My understanding is that index() is supposed 
to be the one-way-to-do-it going forward.  The find() API proved to be 
problematic because -1 is a valid index and people were hitting bugs by failing 
to check for the -1 and then doing an unintended s[-1].

--
nosy: +rhettinger
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue40531] Adding the method find() to list

2020-05-06 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi João, ideas like this can also be proposed first on the python-ideas mailing 
list but as you said in your post there is already a method to do this and it 
raises ValueError when it is not found which is a common idiom in Python. Other 
objects don't often have two versions of the same method, one that raises an 
exception on error and one that returns a sentinel, most only have the one that 
raises.


Notice that your example is not simpler with your proposal:

# Example driver code:
index = find(list, possible_element)
if index_of_element == -1:
pass # Not found
else:
pass # Found


is a hard to read than and actually longer:

try:
index = list.index(possible_element)
except ValueError:
index = -1

if you really care about the number of lines you could use, while I don't 
recommend it:

try: index = list.index(possible_element)
except ValueErrort: index = -1

Also adding a new method to list would mean adding it to all sequence objects 
and that is asking for a lot.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue40517] Syntax highlighting for ASDL

2020-05-06 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Sorry about the commit/revert. I fat fingered a comment.  Please do resubmit 
the PR.  In general, this is a nice idea.  The look just needs to be tweaked a 
bit.

--

___
Python tracker 

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



[issue40527] Multiple "unknown option" errors when passing unknown arguments to the interpreter

2020-05-06 Thread Florian Bruhin


Florian Bruhin  added the comment:

That was an insanely fast fix - thanks everyone! :)

--

___
Python tracker 

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



[issue40529] Auto Completions with case insensitive

2020-05-06 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is a new feature, so it would have to go into 3.9, all older versions are 
in feature-freeze.

--
versions:  -Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue40529] Auto Completions with case insensitive

2020-05-06 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Python is a case-sensitive language. Why would case-insensitive completions be 
useful?

--
nosy: +steven.daprano

___
Python tracker 

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



[issue40533] Subinterpreters: don't share Python objects between interpreters

2020-05-06 Thread STINNER Victor


New submission from STINNER Victor :

To get one GIL per interpreter (bpo-40512), either PyObject.ob_refcnt member 
must become an atomic variable, or subinterpreters must not share any object.

Right now, subinterpreters share Python objects. For example, PyModule_Type is 
declared statically and so shared by all interpreters and so 
PyModule_Type.tp_mro tuple is accessed in parallel by multiple interpreters. If 
PyObject.ob_refcnt is not atomic, Py_INCREF() and Py_DECREF() are unsafe and 
tp_mro tuple can be destroyed whereas it is still used.

I propose to make PyObject.ob_refcnt atomic for now, when Python is built with 
EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro defined. It's a temporary 
workaround until subinterpreters stop sharing objects.

--
components: Interpreter Core
messages: 368262
nosy: vstinner
priority: normal
severity: normal
status: open
title: Subinterpreters: don't share Python objects between interpreters
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



[issue40532] Persmission error

2020-05-06 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

What reason do you have to think that this is a Python issue rather than a 
permissions error?

Since you haven't told us what permissions the file has, what OS you are using, 
who set the permissions, or even the actual error message, it is impossible to 
diagnose the issue, but nothing you have told us so far suggests this is a 
Python issue. It sounds like a local permissions issue that you will have to 
solve yourself.

If you have reason to think this is a Python bug, please explain why, otherwise 
we shall close the issue.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue40532] Persmission error

2020-05-06 Thread Eric V. Smith


Eric V. Smith  added the comment:

What editor are you using? What platform? What file are you trying to edit?

--
nosy: +eric.smith

___
Python tracker 

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



[issue40527] Multiple "unknown option" errors when passing unknown arguments to the interpreter

2020-05-06 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thanks for the bug report Florian and for work Victor!

I am now closing this issue :)

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



[issue40440] allow array.array construction from memoryview w/o copy

2020-05-06 Thread Benjamin Keen


Benjamin Keen  added the comment:

memoryview has a lot of overlap with array, but there are still useful methods 
(index and count for instance) that memoryview does not have. I don't see a 
workaround that will run with equivalent speed without writing some extension 
or adding them to memoryview.

Constructing an array from the memoryview when one wants these isn't a 
workaround because there may not be enough memory to make a copy. For instance 
- a memoryview of a mapped disk file that is much larger than the physical 
memory in the machine.

When writing functions that use an array you don't always know ahead of time 
whether you are going to be in this situation.  The functions may come from 
someone else with a bigger machine. This lets the client of the function decide 
what the right thing to do is as needed without changing the function itself.

So for that reason this brings something that just using the memoryview 
directly won't provide.  There's value in being able to write things that use 
the array interface consistently.

You could also think of this as a way of providing compiled-speed index() and 
count() on certain memoryviews without needing to add new code for that to 
memoryview itself.

--

___
Python tracker 

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



[issue40528] Improve / Clear ASDL generator

2020-05-06 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 091951a67c832db83c60f4eb22f1fb474b70e635 by Batuhan Taskaya in 
branch 'master':
bpo-40528: Improve and clear several aspects of the ASDL definition code for 
the AST (GH-19952)
https://github.com/python/cpython/commit/091951a67c832db83c60f4eb22f1fb474b70e635


--

___
Python tracker 

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



[issue40532] Persmission error

2020-05-06 Thread Code436


New submission from Code436 :

When I try to edit a module *as an administrator* is show permission denied 
even tho in permissions administrator is set to full control

--
messages: 368256
nosy: Coder436
priority: normal
severity: normal
status: open
title: Persmission error
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



[issue40531] Adding the method find() to list

2020-05-06 Thread João Marcos

João Marcos  added the comment:

This is my first issue, is this the right place to discuss enhancements?

--
components: +Library (Lib)

___
Python tracker 

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



[issue40531] Adding the method find() to list

2020-05-06 Thread João Marcos

New submission from João Marcos :

"""
PROBLEM:

When trying to search the position of an element inside a list, we should use 
the `in` operator to first check if the element exists, and then use the 
`index` method to obtain the index.

`in` (__contains__) runs a linear search to return the boolean.
`index`also runs a linear search to return the index.

This makes the code slower, because we need to search for the same item twice.


FEATURE PROPOSAL:

Similar to str.find(), list.find() should be implemented, where -1 is returned 
when the element isn't present
"""


# Since there's no list.find(), this is my workaround to achieve making only 
one linear search per query
def find(container: list, index: int) -> int:
""" Str.find() behavior but for lists """
try:
return container.index(index)
except ValueError:
return -1

# Example driver code:
index = find(list, possible_element)
if index_of_element == -1:
pass # Not found
else:
pass # Found

--
messages: 368254
nosy: João Marcos
priority: normal
severity: normal
status: open
title: Adding the method find() to list
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



[issue29759] Deadlock in multiprocessing.pool.Pool on terminate

2020-05-06 Thread Ionel Cristian Mărieș

Change by Ionel Cristian Mărieș :


--
nosy: +ionelmc

___
Python tracker 

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



[issue40527] Multiple "unknown option" errors when passing unknown arguments to the interpreter

2020-05-06 Thread miss-islington


miss-islington  added the comment:


New changeset bce4ddafdd188cc6deb1584728b67b9e149ca6a4 by Miss Islington (bot) 
in branch '3.8':
bpo-40527: Fix command line argument parsing (GH-19955)
https://github.com/python/cpython/commit/bce4ddafdd188cc6deb1584728b67b9e149ca6a4


--

___
Python tracker 

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



[issue40528] Improve / Clear ASDL generator

2020-05-06 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

A real world example would be tools like `unimport`, that try to remove a 
certain part of import by looking start/end column offsets. Before (lib2to3), 
it was using tokens to manipulate source, and what I can tell is that having 
position information on multi line from imports would be a life saver for tool 
authors.

--

___
Python tracker 

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



[issue40528] Improve / Clear ASDL generator

2020-05-06 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Oh, I confuse with it identifier. IMHO replacing identifier with Constant would 
infer position in some cases.

--

___
Python tracker 

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



  1   2   >