[issue43493] EmailMessage mis-folding headers of a certain length

2021-03-17 Thread Mike Glover


Mike Glover  added the comment:

Further research shows that email.parser.Parser is not handling the affected 
lines correctly -- the leading '\n ' is not being stripped from the header 
value.

Attached is the (ugly, worksforme) function I'm using to workaround this problem

--
Added file: https://bugs.python.org/file49889/foldfix.py

___
Python tracker 

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



[issue42161] Remove private _PyLong_Zero and _PyLong_One variables

2021-03-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Thanks Raymond, I fixed the code.

Can you fix all the other cases where this is used in inner-loop; otherwise, it 
is undoing everyone else's optimizations and fast paths.

Also, it seems the that primary motivation for this is support subinterpreters. 
 That PEP hasn't been approved, so we should not be making code worse until we 
know there is going to some offsetting benefit.

For example, the inner-loop code in math_lcm() used to have "res == 
_PyLong_Zero" which was fast a register-to-register comparison (1 cycle at 
worst and typically 0 cycles with branch prediction).  Also there used to be 
zero memory accesses.   The new code has five sequentially dependent operations 
and four memory accesses (not what we want in an inner-loop):

movq__PyRuntime@GOTPCREL(%rip), %rax
movq616(%rax), %rax
movq16(%rax), %rax
cmpq%r12, 3560(%rax)
jne L326

Ideally, the whole PR should be reverted until the subinterpreter PEP is 
approved.  If not, then at least the changes should be made more carefully, 
hoisting the new call out of the hot loop:

+   zero = _PyLong_GetZero();
for (i = 1; i < nargs; i++) {
x = PyNumber_Index(args[i]);
if (x == NULL) {
Py_DECREF(res);
return NULL;
}
-   if (res == _PyLong_GetZero()) {
+   if (res == zero) {
/* Fast path: just check arguments.
   It is okay to use identity comparison here. */
Py_DECREF(x);
continue;
}
Py_SETREF(res, long_lcm(res, x));
Py_DECREF(x);
if (res == NULL) {
return NULL;
}
}
return res;

--
nosy: +pablogsal, serhiy.storchaka
status: closed -> open

___
Python tracker 

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



[issue43536] 3.9.2 --without-pymalloc --with-pydebug --with-valgrind: test failed: test_posix

2021-03-17 Thread Thermi


Thermi  added the comment:

PKGBUILD I use to build the python package I need for debugging on Arch.

Only changes to it are the addition of the 3 configure flags mentioned in the 
title.
Other than that, it should work fine.
I built the package previously without those changes and that worked.

flags: --without-pymalloc --with-pydebug --with-valgrind

--
Added file: https://bugs.python.org/file49888/PKGBUILD

___
Python tracker 

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



[issue43536] 3.9.2 --without-pymalloc --with-pydebug --with-valgrind: test failed: test_posix

2021-03-17 Thread Thermi


New submission from Thermi :

--

Ran 210 tests in 0.950s

OK (skipped=26)

== Tests result: FAILURE ==

412 tests OK.

1 test failed:
test_posix

10 tests skipped:
test_devpoll test_gdb test_kqueue test_msilib test_ossaudiodev
test_startfile test_winconsoleio test_winreg test_winsound
test_zipfile64

Total duration: 1 hour 3 min
Tests result: FAILURE


test test_posix failed  
   
0:38:00 load avg: 1.89 [265/423/1] test_posixpath -- test_posix failed  
 

Possibly related: test_setscheduler_with_policy 
(test.test_posix.TestPosixSpawnP) ... ERROR 
 

test_setscheduler_with_policy (test.test_posix.TestPosixSpawn) ... ERROR
   

Distribution: Arch Linux
Linux 5.11.6-arch1-1
gcc 10.2.0-6
glibc 2.33-4
valgrind 3.16.1-4

--
components: Tests
files: config.log
messages: 388986
nosy: Thermi
priority: normal
severity: normal
status: open
title: 3.9.2 --without-pymalloc --with-pydebug --with-valgrind: test failed: 
test_posix
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49887/config.log

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-17 Thread Vedran Čačić

Vedran Čačić  added the comment:

I can't find it now, but I seem to remember me having this same proposal 
(except the part for bytes) quite a few years ago, and you being the most vocal 
opponent. What changed? Of course, I'm still for it.

(Your second list has fourth item extra. But it's clear what you wanted to say.)

--
nosy: +veky

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-17 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue43532] Add keyword-only fields to dataclasses

2021-03-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

+1 for this idea.  I don't see any downside.

--
nosy: +rhettinger

___
Python tracker 

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



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2021-03-17 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> docs@python
components: +Documentation -Windows
nosy: +docs@python
type: performance -> behavior

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-17 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Rather than just erroring-out, it would be nice if str.join converted inputs to 
strings when needed.

Currently:

data = [10, 20, 30, 40, 50]
s = ', '.join(map(str, data))

Proposed:

s = ', '.join(data)

That would simplify a common idiom.  That is nice win for beginners and it 
makes code more readable.  

The join() method is unfriendly in a number of ways.  This would make it a bit 
nicer.

There is likely to be a performance win as well.  The existing idiom with map() 
roughly runs like this:

 * Get iterator over: map(str, data)
 * Without length knowledge, build-up a list of strings
   periodically resizing and recopying data (1st pass)
 * Loop over the list strings to compute the combined size
   (2nd pass)
 * Allocate a buffer for the target size
 * Loop over the list strings (3rd pass), copying each
   into the buffer and wrap the result in a string object.

But, it could run like this:
 * Use len(data) or a length-hint to presize the list of strings.
 * Loop over the data, converting each input to a string if needed,
   keeping a running total of the target size, and storing in the
   pre-sized list of strings (all this in a single 1st pass)
 * Allocate a buffer for the target size
 * Loop over the list strings (2nd pass), copying each
   into the buffer
 * Loop over the list strings (3rd pass), copying each
   into the buffer and wrap the result in a string object.

AFAICT, the proposal is mostly backwards compatible, the only change is that 
code that currently errors-out will succeed.

For bytes.join() and bytearray.join(), the only auto-conversion that makes 
sense is from ints to bytes so that you could write:  

 b' '.join(data)

instead of the current:

b' '.join([bytes([x]) for x in data])

--
components: Interpreter Core
messages: 388983
nosy: pablogsal, rhettinger
priority: normal
severity: normal
status: open
title: Make str.join auto-convert inputs to strings.
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue43244] Move PyArena C API to the internal C API

2021-03-17 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23676
pull_request: https://github.com/python/cpython/pull/24913

___
Python tracker 

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



[issue43534] turtle.textinput window is not transient

2021-03-17 Thread John Private


John Private  added the comment:

I am enclosing a PNG showing the difference between 3.9.1 and 3.9.2

In 3.9.2 the pop-up opens as a new window complete with minimise and maximise 
buttons, and the position is unrelated to the turtle screen.

--
nosy: +jwmp5051
Added file: https://bugs.python.org/file49886/textinput.png

___
Python tracker 

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



[issue43244] Move PyArena C API to the internal C API

2021-03-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e0bf70d08c4a4a68782702e747e6bf7670667591 by Victor Stinner in 
branch 'master':
bpo-43244: Fix test_peg_generator for PyAST_Validate() (GH-24912)
https://github.com/python/cpython/commit/e0bf70d08c4a4a68782702e747e6bf7670667591


--

___
Python tracker 

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



[issue21822] [Windows] KeyboardInterrupt during Thread.join hangs that Thread

2021-03-17 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner
title: KeyboardInterrupt during Thread.join hangs that Thread -> [Windows] 
KeyboardInterrupt during Thread.join hangs that Thread

___
Python tracker 

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



[issue43395] os.path states that bytes can't represent all MBCS paths under Windows

2021-03-17 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



[issue43534] turtle.textinput window is not transient

2021-03-17 Thread Chris Winkler


New submission from Chris Winkler :

When `turtle.textinput` is called in Python 3.9.2, the resulting dialog window 
is not marked as transient. This is not a problem in 3.9.1.

The offending change seems to come from bpo-42630. Specifically, 
`SimpleDialog.__init__` is being passed `parent=None`, and because of this 
`self.transient(parent)` is not being called.

A minimal program to reproduce the bug is attached. I'm happy to submit a pull 
request or something if it would help, but I don't know whether it's more 
correct to replace `parent` with `master` in the aforementioned if statement or 
something else.

--
components: Tkinter
files: textinput_test.py
messages: 388980
nosy: quid256
priority: normal
severity: normal
status: open
title: turtle.textinput window is not transient
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49885/textinput_test.py

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-03-17 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 08fb8ac99ab03d767aa0f1cfab3573eddf9df018 by Pablo Galindo in 
branch 'master':
bpo-42128: Add 'missing :' syntax error message to match statements (GH-24733)
https://github.com/python/cpython/commit/08fb8ac99ab03d767aa0f1cfab3573eddf9df018


--

___
Python tracker 

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



[issue31103] Windows Installer Product does not include micro version in display name

2021-03-17 Thread Eryk Sun


Eryk Sun  added the comment:

FYI, the 3rd field is Field3Value, defined in "PCbuild/python.props" as the 
value `MicroVersionNumber*1000 + ReleaseLevelNumber*10 + ReleaseSerial`. It 
gets set as the FIELD3 macro in "PCbuild/pyproject.props", which gets used in 
the definition of the PYVERSION64 macro in "PC/python_ver_rc.h". PYVERSION64 is 
used as the FILEVERSION and PRODUCTVERSION in the resource files. But note that 
the "FileVersion" and "ProductVersion" string values are instead based on the 
PY_VERSION macro, which is defined in "Include/patchlevel.h", which for release 
builds is the normal "major.minor.micro" string. 

In "Tools/msi/msi.props", Field3Value is used in the "Version" variable as 
follows: "$(MajorVersionNumber).$(MinorVersionNumber).$(Field3Value).0", which 
is used for all of the MSIs and the bundle. 

> Display Version should start with 3.X.Y or 3.X.Y.

Is this referring to the above MSI version value, which gets displayed in the 
version column in "Programs and Features"? I'm far from an expert with MSI. 
This is Steve's wheelhouse, and he'll correct me if I'm wrong, but I think it's 
important that at least one of the first 3 fields changes for a normal update. 
In the development cycle, it's thus up to the Field3Value, as the release level 
(10, 11, 12, 15) and serial (0, 1, 2, ...) are incremented. In that case the 
3rd field cannot be just the micro version number.

--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6, Python 3.7

___
Python tracker 

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



[issue43533] Exception and contextmanager in __getattr__ causes reference cycle

2021-03-17 Thread Ran Chen


New submission from Ran Chen :

If __getattr__ raises exception within a contextlib.context_manager, it creates 
a reference cycle and prevents the frame from being garbage collected. This 
only happens if the exception is raised inside a context manager inside 
__getattr__. It doesn't happen if there's no context manager.

Repro:

```
import contextlib
import gc

@contextlib.contextmanager
def ct():
  yield


class A(object):

  def __getattr__(self, name):
with ct():
  raise AttributeError()
  


def f():
  a = A()
  hasattr(a, 'notexist')


gc.set_debug(gc.DEBUG_LEAK)
f()
gc.collect()
```

It also doesn't happen if we catch the exception outside of the context manager 
and re-raise it:

```
  def __getattr__(self, name):
try:
  with ct():
raise AttributeError()
except:
  raise
```

--
components: Library (Lib)
messages: 388977
nosy: crccw
priority: normal
severity: normal
status: open
title: Exception and contextmanager in __getattr__ causes reference cycle
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



[issue43532] Add keyword-only fields to dataclasses

2021-03-17 Thread jack1142


Change by jack1142 :


--
nosy: +jack1142

___
Python tracker 

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



[issue43244] Move PyArena C API to the internal C API

2021-03-17 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23675
pull_request: https://github.com/python/cpython/pull/24912

___
Python tracker 

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



[issue43521] Allow `ast.unparse` to handle NaNs and empty sets

2021-03-17 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

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



[issue31861] add aiter() and anext() functions

2021-03-17 Thread jack1142


Change by jack1142 :


--
nosy: +jack1142

___
Python tracker 

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



[issue43244] Move PyArena C API to the internal C API

2021-03-17 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23673
pull_request: https://github.com/python/cpython/pull/24911

___
Python tracker 

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



[issue12575] add a AST validator

2021-03-17 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner
nosy_count: 8.0 -> 9.0
pull_requests: +23674
pull_request: https://github.com/python/cpython/pull/24911

___
Python tracker 

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



[issue43244] Move PyArena C API to the internal C API

2021-03-17 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23672
pull_request: https://github.com/python/cpython/pull/24910

___
Python tracker 

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



[issue43244] Move PyArena C API to the internal C API

2021-03-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 526fdeb2278b61653df704d7cfcaedde504dee48 by Victor Stinner in 
branch 'master':
bpo-43244: Add pycore_ast.h header file (GH-24908)
https://github.com/python/cpython/commit/526fdeb2278b61653df704d7cfcaedde504dee48


--

___
Python tracker 

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



[issue27901] DOC: inspect.ismethod returns different results on the same basic code between Python2.7 Python3.5

2021-03-17 Thread Irit Katriel


Irit Katriel  added the comment:

There seems to be agreement on this resolution:

> add a cross link from 'bound method' to
> the 'instance methods' section of the data model docs.

I'm updating version and marking as easy.

--
keywords: +easy
nosy: +iritkatriel
title: inspect.ismethod returns different results on the same basic code 
between Python2.7 Python3.5 -> DOC: inspect.ismethod returns different results 
on the same basic code between Python2.7 Python3.5
type:  -> enhancement
versions: +Python 3.10 -Python 3.5

___
Python tracker 

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



[issue43532] Add keyword-only fields to dataclasses

2021-03-17 Thread Eric V. Smith


Change by Eric V. Smith :


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

___
Python tracker 

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



[issue43244] Move PyArena C API to the internal C API

2021-03-17 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23670
pull_request: https://github.com/python/cpython/pull/24908

___
Python tracker 

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



[issue22128] patch: steer people away from codecs.open

2021-03-17 Thread Irit Katriel


Irit Katriel  added the comment:

Since Martin corrected the docs in issue 19548 for python 3, and python 2 is no 
longer relevant, I believe this can be closed.

--
nosy: +iritkatriel
resolution:  -> duplicate
status: open -> pending
superseder:  -> 'codecs' module docs improvements

___
Python tracker 

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



[issue43244] Move PyArena C API to the internal C API

2021-03-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b4536e1c6abe4c6219177a89e16575d05ea22f64 by Victor Stinner in 
branch 'master':
bpo-43244: Rename pycore_ast.h to pycore_ast_state.h (GH-24907)
https://github.com/python/cpython/commit/b4536e1c6abe4c6219177a89e16575d05ea22f64


--

___
Python tracker 

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



[issue42730] TypeError/hang inside of Time.Sleep() when _thread.interrupt_main()

2021-03-17 Thread Eryk Sun


Eryk Sun  added the comment:

> Shouldn't the behaviour for _thread.interrupt_main() be always to 
> interrupt the main thread. 

The underlying C API function, PyErr_SetInterrupt(), simulates SIGINT without 
actually sending the signal to the process via kill() or raise(), but the doc 
string of interrupt_main() doesn't explain this, or at least it didn't used to. 
bpo-43356 generalized _thread.interrupt_main() to support simulating any 
available signal, and hopefully the new doc string [1] clarifies the intent.

---

[1] 
https://github.com/python/cpython/blob/9976834f807ea63ca51bc4f89be457d734148682/Modules/_threadmodule.c#L1194

--
stage:  -> resolved
status: open -> closed
superseder:  -> _thread.interrupt_main() errors if SIGINT handler in SIG_DFL, 
SIG_IGN

___
Python tracker 

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



[issue30044] shutil.copystat should (allow to) copy ownership, and other attributes

2021-03-17 Thread Steve Dower


Steve Dower  added the comment:

Just wanted to add that the sooner we can offer a wrapper around CopyFileEx on 
Windows (with no callbacks), the sooner we can take advantage of some 
significant optimisations that are being done to this function (which I can't 
share details of right now, but concrete work is being done).

Personally, I'm fine with it being copy2() and we take the slight behaviour 
change. But it should definitely be easy for users to access and use.

--
nosy: +steve.dower

___
Python tracker 

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



[issue43244] Move PyArena C API to the internal C API

2021-03-17 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23669
pull_request: https://github.com/python/cpython/pull/24907

___
Python tracker 

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



[issue35883] Python startup fails with a fatal error if a command line argument contains an invalid Unicode character

2021-03-17 Thread miss-islington


miss-islington  added the comment:


New changeset aa967ec4d4c2fc844f8f16b339140b050ae4d5e2 by Miss Islington (bot) 
in branch '3.9':
bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)
https://github.com/python/cpython/commit/aa967ec4d4c2fc844f8f16b339140b050ae4d5e2


--

___
Python tracker 

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



[issue39090] Document various options for getting the absolute path from pathlib.Path objects

2021-03-17 Thread 4-launchpad-kalvdans-no-ip-org


Change by 4-launchpad-kalvdans-no-ip-org :


--
nosy: +4-launchpad-kalvdans-no-ip-org

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-03-17 Thread STINNER Victor


STINNER Victor  added the comment:

I checked manually cloudpickle_bug.py attached to bpo-43228: it works as 
expected. The bpo-43228 regression has been fixed. I close again the issue.

It was proposed to add a builtins parameter to the types.FunctionType 
constructor. If someone wants to add it: please go ahead ;-)

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



[issue43228] Regression in function builtins

2021-03-17 Thread STINNER Victor


STINNER Victor  added the comment:

Issue fixed in bpo-42990.

--
priority: release blocker -> 
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue42370] test_ttk_guionly: test_to() fails on the GitHub Ubuntu job

2021-03-17 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



[issue43068] test_subprocess: test_specific_shell() fails on AMD64 FreeBSD Shared 3.x

2021-03-17 Thread STINNER Victor


STINNER Victor  added the comment:

The two FreeBSD 3.x buildbot are back to green, I close the issue.

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



[issue25386] msvcrt_putch/msvcrt_putwch don't check the return value of _putch/_putwch

2021-03-17 Thread Eryk Sun


Change by Eryk Sun :


--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue40533] [subinterpreters] Don't share Python objects between interpreters

2021-03-17 Thread STINNER Victor


STINNER Victor  added the comment:

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

The current plan is to not share any object between two interpreters, so this 
PR is not needed. I close my PR 19958 which marked PyObject.ob_refcnt as atomic.

--

___
Python tracker 

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



[issue35883] Python startup fails with a fatal error if a command line argument contains an invalid Unicode character

2021-03-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23668
pull_request: https://github.com/python/cpython/pull/24906

___
Python tracker 

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



[issue35883] Python startup fails with a fatal error if a command line argument contains an invalid Unicode character

2021-03-17 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 7.0 -> 8.0
pull_requests: +23667
pull_request: https://github.com/python/cpython/pull/24905

___
Python tracker 

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



[issue35883] Python startup fails with a fatal error if a command line argument contains an invalid Unicode character

2021-03-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9976834f807ea63ca51bc4f89be457d734148682 by Victor Stinner in 
branch 'master':
bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)
https://github.com/python/cpython/commit/9976834f807ea63ca51bc4f89be457d734148682


--

___
Python tracker 

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



[issue33240] shutil.rmtree fails if inner folder is open in Windows Explorer

2021-03-17 Thread Eryk Sun


Change by Eryk Sun :


--
components:  -IO

___
Python tracker 

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



[issue33240] shutil.rmtree fails if inner folder is open in Windows Explorer

2021-03-17 Thread Eryk Sun


Eryk Sun  added the comment:

> Explorer keeps handles open to directories to get updates via
> ReadDirectoryChangesExW. It opens watched directories with 
> shared delete access, so deleting the child succeeds. But as 
> discussed above, the directory isn't unlinked from the parent
> until Explorer closes its handle.

In Windows 10, NTFS allows deleting an empty directory that's currently opened 
with shared-delete access, so this race condition will be increasingly less 
common. For example:

access = GENERIC_READ
sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE
disposition = OPEN_EXISTING
flags = FILE_FLAG_BACKUP_SEMANTICS

os.mkdir('spam')
h = CreateFile('spam', access, sharing, None, disposition, flags, None)
os.rmdir('spam')

>>> print(GetFinalPathNameByHandle(h, 0))
\\?\C:\$Extend\$Deleted\004E632F70819337

FAT filesystems do not support this capability, and may never support it, so 
the problem hasn't gone away completely.

--
versions: +Python 3.10, Python 3.9 -Python 3.6, Python 3.7

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2021-03-17 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue39340] shutil.rmtree and write protected files

2021-03-17 Thread Eryk Sun


Eryk Sun  added the comment:

> What I would expect is a consistent behaviour and as a 
> user I am not interested in inner guts of differences 
> between filesystems.

It's already consistent. msg360033 contains a misunderstanding about what write 
permission on a file means in Unix. The parent directory controls whether a 
file can be unlinked -- except for immutable files. For example:

$ mkdir test; touch test/file.txt; chmod -w test
$ python3.8 -c "import shutil; shutil.rmtree('test')"
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.8/shutil.py", line 715, in rmtree
_rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.8/shutil.py", line 672, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib/python3.8/shutil.py", line 670, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'file.txt'

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



[issue43437] venv activate bash script has wrong line endings on windows

2021-03-17 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> venv activate bash script has wrong line endings in Windows

___
Python tracker 

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



[issue32451] venv activate bash script has wrong line endings in Windows

2021-03-17 Thread Eryk Sun


Eryk Sun  added the comment:

The POSIX "Lib/venv/scripts/common/activate" script needs a line-ending 
exception in ".gitattributes":

https://github.com/python/cpython/blob/master/.gitattributes

--
title: python -m venv activation issue when using cygwin on windows -> venv 
activate bash script has wrong line endings in Windows
versions: +Python 3.10, Python 3.9 -Python 3.6, Python 3.7

___
Python tracker 

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



[issue43395] os.path states that bytes can't represent all MBCS paths under Windows

2021-03-17 Thread Eryk Sun


Change by Eryk Sun :


--
versions:  -Python 3.6, Python 3.7

___
Python tracker 

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



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

2021-03-17 Thread Eryk Sun


Change by Eryk Sun :


--
components: +Library (Lib)
versions:  -Python 3.6, Python 3.7

___
Python tracker 

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



[issue21822] KeyboardInterrupt during Thread.join hangs that Thread

2021-03-17 Thread Eryk Sun


Change by Eryk Sun :


--
components: +Extension Modules, Interpreter Core
versions: +Python 3.10, Python 3.9 -Python 3.6, Python 3.7

___
Python tracker 

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



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2021-03-17 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



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2021-03-17 Thread Eryk Sun


Eryk Sun  added the comment:

> Given that extra info, I'd say we're fine to document that our timeouts 
> can't do any better than the OS, which "for example, is typically 
> around 15ms on Windows", and recommend using non-blocking calls 
> instead.

The 15.625 ms resolution limit is fine, as long as performance is predictable. 
I don't like the random inconsistency introduced by extending only certain 
waits, in different ways, to support SIGINT and/or waits longer than 49.7 days. 
For example, time.sleep() doesn't ignore WAIT_TIMEOUT to recompute the 
remaining time, so it's not subject to the resolution limit that's imposed by 
GetTickCount64().

I'd prefer a common implementation of _Py_Sleep, _Py_WaitForSingleObject, and 
_Py_WaitForMultiple objects in order to be able to definitively state that all 
wait timeouts are unconditionally limited to the resolution reported by 
time.get_clock_info('monotonic').resolution; are not limited to 49.7 days; and 
can be interrupted by Ctrl+C in the main thread -- except for waiting on I/O. 
(There's an open issue to enable Ctrl+C to cancel synchronous I/O in the main 
thread -- such as reading from a pipe.)

--

___
Python tracker 

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



[issue43532] Add keyword-only fields to dataclasses

2021-03-17 Thread Ryan Hiebert


Change by Ryan Hiebert :


--
nosy: +ryanhiebert

___
Python tracker 

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



[issue43532] Add keyword-only fields to dataclasses

2021-03-17 Thread Kamil Turek


Change by Kamil Turek :


--
nosy: +kamilturek

___
Python tracker 

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



[issue29687] smtplib does not support proxy

2021-03-17 Thread Christian Heimes


Christian Heimes  added the comment:

It's not a public API but it's a stable API. It hasn't changed since Python 2.6 
and commit 366d6262f81 from 2007. It's unlikely to change in the near future.

--

___
Python tracker 

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



[issue43483] Loss of content in simple (but oversize) SAX parsing

2021-03-17 Thread Larry Trammell


Larry Trammell  added the comment:

If there were a decision NOT TO FIX... maybe then it would make sense to 
consider documentation patches at a higher priority.  That way, SAX-Python (and 
expat-Python) tutorials across the Web could start patching their presentations 
accordingly.

--

___
Python tracker 

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



[issue29687] smtplib does not support proxy

2021-03-17 Thread Ryan Hiebert


Ryan Hiebert  added the comment:

Thank you, Christian. It sounds like you believe that we should view the 
`_get_socket` method as a public interface? That at least makes it possible to 
use a proxy socket through an appropriate mechanism, which solves my use-case.

--

___
Python tracker 

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



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The result of help('modules') depends on Python version. Do you have any 
example which does not depend on Python version?

Could you also run some pure Tcl/Tk demos to check whether the difference is in 
Tcl/Tk instead of the wrapper?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue43531] Turtle module does not work

2021-03-17 Thread Adrian LeDeaux


Adrian LeDeaux  added the comment:

OK.

--

___
Python tracker 

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



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you Ammar.

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



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset db733761060be92915b5f5cba209dcaada88f94e by Ammar Askar in branch 
'3.9':
[3.9] bpo-43499: Restrict co_code to be under INT_MAX in codeobject (GH-20628) 
(GH-24896)
https://github.com/python/cpython/commit/db733761060be92915b5f5cba209dcaada88f94e


--

___
Python tracker 

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



[issue33129] Add kwarg-only option to dataclass

2021-03-17 Thread Eric V. Smith


Eric V. Smith  added the comment:

Closing this in favor of issue 43532, which has a slightly elaborated approach.

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Add keyword-only fields to dataclasses

___
Python tracker 

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



[issue43483] Loss of content in simple (but oversize) SAX parsing

2021-03-17 Thread Larry Trammell


Larry Trammell  added the comment:

I think the existing ContentHandler.characters(content) documentation DOES say 
that the text can come back in chunks... but it is subtle.  It might be 
possible to say more explicitly that any content no matter how small is allowed 
to be returned as any number of chunks at any time... Though true, that is 
harsh, overstating considerably what actually happens.   Concentrating on a 
better implementation would be more effective than worrying about existing 
documentation, given how long the existing conditions have prevailed. My 
opinion, as one who has been bitten.

--

___
Python tracker 

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



[issue43532] Add keyword-only fields to dataclasses

2021-03-17 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This looks like a duplicate of https://bugs.python.org/issue33129 or that 
ticket can be closed.

--
nosy: +xtreak

___
Python tracker 

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



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2021-03-17 Thread Steve Dower


Steve Dower  added the comment:

Given that extra info, I'd say we're fine to document that our timeouts can't 
do any better than the OS, which "for example, is typically around 15ms on 
Windows", and recommend using non-blocking calls instead.

--

___
Python tracker 

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



[issue43532] Add keyword-only fields to dataclasses

2021-03-17 Thread Eric V. Smith


New submission from Eric V. Smith :

The idea is that a keyword-only field becomes a keyword-only argument to 
__init__().

For the proposal and a discussion, see 
https://mail.python.org/archives/list/python-id...@python.org/message/FI6KS4O67XDEIDYOFWCXMDLDOSCNSEYG/

The @dataclass decorator will get a new parameter, kw_only, which defaults to 
False. If kw_only=True, all fields in the dataclass will be by efault 
keyword-only. In addition, field() will have a new kw_only parameter. If true, 
the field will be keyword-only. If false, it will not be keyword-only. If 
unspecified, it will use the value of dataclass's kw_only parameter.

In addition, a module-level variable KW_ONLY will be added. If a field has this 
type, then all fields after it will default to kw_only=True. The field is 
otherwise completely ignored.

Examples:

@dataclasses.dataclass
class A:
a: Any = field(kw_only=True) 

Will have __init__(self, *, a)

@dataclasses.dataclass(kw_only=True)
class B:
a: Any
b: Any 

Will have __init__(self, *, a, b)

@dataclasses.dataclass
class C:
a: Any
_: dataclasses.KW_ONLY
b: Any
c: Any

Will have __init__(self, a, *, b, c)

If any non-keyword-only parameters are present, they will be moved before all 
keyword-only parameters, only for the generated __init__. All other generated 
methods (__repr__, __lt__, etc.) will keep fields in the declared order, which 
is the case in versions 3.9 and earlier.

@dataclasses.dataclass
class D:
a: Any
b: Any = field(kw_only=True)
c: Any

Will have __init__(self, a, c, *, b)

PR to follow.

--
assignee: eric.smith
components: Library (Lib)
messages: 388949
nosy: eric.smith
priority: normal
severity: normal
status: open
title: Add keyword-only fields to dataclasses
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2021-03-17 Thread Eryk Sun


Eryk Sun  added the comment:

See the related discussion in bpo-41299. The system interrupt period can be 
lowered to 1 ms with timeBeginPeriod() -- or lower with undocumented 
NtSetTimerResolution(). This affects the resolution of dispatcher waits such as 
Sleep() and WaitForSingleObject(), as well as the resolution of 
Query[Unbiased]InterruptTime(). But apparently GetTickCount[64]() has a fixed 
update frequency of 64 ticks/second (15.625 ms period), regardless of the 
system interrupt period. The combination of WaitForSingleObject() with 
GetTickCount64() has marginally better resolution and consistent performance if 
the system interrupt period is lowered to 1 ms.

If a wait needs to be resumable in order to handle SIGINT, and it should 
perform consistently with other waits, then there are two choices. One option 
is to base the timeout on Query[Unbiased]InterruptTime(), for which the 
resolution depends on the system interrupt period. Conversely, if we want all 
waits to perform consistently and independent of the system interrupt period, 
then they should all depend on GetTickCount64(). This could be implemented in 
one place, such as Modules/signalmodule.c, with the addition of _Py_Sleep(), 
Py_WaitForSingleObject(), and _Py_WaitForMultipleObjects(). On the main thread, 
these wait functions would include the SIGINT event and resume the wait if the 
SIGINT handler doesn't raise an exception.

--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6, Python 3.7

___
Python tracker 

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



[issue29687] smtplib does not support proxy

2021-03-17 Thread Christian Heimes


Christian Heimes  added the comment:

The Python standard library has no builtin support for socks proxy. I suggest 
that you report issues with socks library to the author of the package.

By the way the smptlib makes it really easy to override the socket object with 
a custom implementation:

class SocksSMTP(smtplib.SMTP):
def _get_socket(self, host, port, timeout):
return some_socket_like_object(...)

--
nosy: +christian.heimes
resolution:  -> third party
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue43483] Loss of content in simple (but oversize) SAX parsing

2021-03-17 Thread Larry Trammell


Larry Trammell  added the comment:

Oh, and whether this affects only content text...

I would presume so, but I don't know how to tell for sure.  Unspecified 
behaviors can be very mysterious!

--

___
Python tracker 

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



[issue43531] Turtle module does not work

2021-03-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

For next time, the turtle module is not part of IDLE.

--
assignee: terry.reedy -> 
components: +Library (Lib) -IDLE

___
Python tracker 

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



[issue43284] Inability to fetch build 20H2

2021-03-17 Thread Steve Dower


Steve Dower  added the comment:

CMD is not going to be subjected to compatibility shims that hide the version 
number, and I *think* those are not inherited by child processes. So it can use 
the basic APIs. (It's also likely to be the comparison that most people will 
check against.)

I agree that using WMI is probably overkill. PyWin32 or a new extension module 
could handle it for people who have a more urgent need.

--

___
Python tracker 

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



[issue43477] from x import * behavior inconsistent between module types.

2021-03-17 Thread Brett Cannon


Brett Cannon  added the comment:

Having `test_pkg.test_submodule` be set after your import based on the sequence 
of imports your example executes is entirely expected and a side-effect of how 
import is (at least now) designed. So I disagree with the assessment "that 
nothing here was requested by the user", since imports have side-effects, and 
one of those is setting submodules as attributes on packages post-import.

Thanks for the report and all the details, Thomas, but I am still going to 
close this as not a bug.

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

___
Python tracker 

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



[issue43483] Loss of content in simple (but oversize) SAX parsing

2021-03-17 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think that's good text, once the enhancement is made. But for existing 
versions of python, shouldn't we just document that the text might come back in 
chunks?

I don't have a feel for what the limit should be.

--

___
Python tracker 

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



[issue43471] Fails to import bz2 on Ubuntu

2021-03-17 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm going to close this. @xmm: If you can provide more information showing that 
this is a bug in Python or its build process, please re-open this issue.

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



[issue43483] Loss of content in simple (but oversize) SAX parsing

2021-03-17 Thread Larry Trammell


Larry Trammell  added the comment:

Great minds think alike I guess... 

I was thinking of a much smaller carryover size... maybe 1K. With individual 
text blocks longer than that, the user will almost certainly be dealing with 
collecting and aggregating content text anyway, and in that case, the problem 
is solved before it happens. 

Here is a documentation change I was experimenting with...

---
ContentHandler.characters(content) -- The Parser will call this method to 
report chunks of character data.  In general, character data may be reported as 
a single chunk or as sequence of chunks; but character data sequences with 
fewer than  xml.sax.handler.ContiguousChunkLength characters, when 
uninterrupted any other xml.sax.handler.ContentHandler event, are guaranteed to 
be delivered as a single chunk...  
---

That puts users on notice, "...wait, are my chunks of text smaller than that?" 
and they are less likely to be caught unaware.  But of course, the 
implementation change would be helpful even without this extra warning.

--

___
Python tracker 

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



[issue43483] Loss of content in simple (but oversize) SAX parsing

2021-03-17 Thread Eric V. Smith


Eric V. Smith  added the comment:

Thanks, that's very helpful. Does this only affect content text?

This should definitely be documented.

As far as changing it, I think the best thing to do is say that if the context 
text is less than some size (I don't know, maybe 1MB?) that it's guaranteed to 
be in one callback, but if it's larger than that it might be in multiple 
chunks. I think you could open this as a feature request. I have no idea how 
difficult or expensive it would be to implement this.

--

___
Python tracker 

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



[issue43483] Loss of content in simple (but oversize) SAX parsing

2021-03-17 Thread Larry Trammell


Larry Trammell  added the comment:

Sure...  I'll cut and paste some of the text I was organizing to go into a 
possible new issue page.

The only relevant documentation I could find was in the "xml.sax.handler" page 
in the Python 3.9.2 Documentation for the Python Standard Library (as it has 
been through many versions):

---
ContentHandler.characters(content) -- The Parser will call this method to 
report each chunk of character data.  SAX parsers may return all contiguous 
character data in a single chunk, or they may split it into several chunks...
---

As an example, here is a typical snippet taken from Web page

 https://www.tutorialspoint.com/parsing-xml-with-sax-apis-in-python 

The application example records the tag name "type" in the "CurrentData" 
member, and shortly thereafter, the "type" tag's content is received:

   # Call when a character is read
   def characters(self, content):
  if self.CurrentData == "type":
 self.type = content

Suppose that the parser receives the following text line from the input file.  

SciFi

Though there seems no reason for it, the parser could decide to deliver the 
content text as "Sc" followed by "iFi".  In that case, a second invocation of 
the "characters" method would overwrite the characters received in the first 
invocation, and some of the content text seems "lost."  

Given how rarely it happens, I suspect that when internal processing reaches 
the end of a block of buffered text from the input file, the easiest thing to 
do is to report any fragments of text that happen to remain at the end, no 
matter how tiny, and start fresh with the next internal buffer. Easy for the 
implementer, but baffling to the application developer.  And rare enough to 
elude application testing.

--

___
Python tracker 

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



[issue43284] Inability to fetch build 20H2

2021-03-17 Thread Eryk Sun


Eryk Sun  added the comment:

> For the other 10% (diagnostic logging), it would be nice to have a
> better option than running "cmd /c ver"

CMD's VER command (cmd!eVersion) calls GetVersion(), for which, in its case, 
the API calls the internal function GetVersion_Current(). The VER command also 
reads the UBR value (update build revision) directly from the registry.

Other than using CMD, I suppose there's the option of creating an extension 
module in C++ that gets the Win32_OperatingSystem WMI data, which includes the 
"major.minor.build" version string. But that's much more complicated.

--

___
Python tracker 

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



[issue43531] Turtle module does not work

2021-03-17 Thread Mark Dickinson


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



[issue43531] Turtle module does not work

2021-03-17 Thread Adrian LeDeaux


Adrian LeDeaux  added the comment:

That fixed it.

--

___
Python tracker 

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



[issue43336] document whether io.TextIOBase.readline(size>0) will always read the full newline

2021-03-17 Thread Christoph Anton Mitterer


Christoph Anton Mitterer  added the comment:

I guess that the translation from CRLF to LF simply happens before the size 
restriction is enforced (which is good so, btw), so effectively it:

will not *read* at most size characters from the stream, but *return* at most 
size characters from it (with any newlines translated before, and thus more 
characters read from the stream than returned)

--

___
Python tracker 

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



[issue43531] Turtle module does not work

2021-03-17 Thread Adrian LeDeaux


Adrian LeDeaux  added the comment:

Oh, OK. I am not an expert on python so I did not understand the error. Thanks 
for the help, and I will update you if the problems continue.

--

___
Python tracker 

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



[issue43531] Turtle module does not work

2021-03-17 Thread Mark Dickinson


Mark Dickinson  added the comment:

You have a local file named `turtle.py`, which is conflicting with the standard 
library `turtle` module.  Rename your local file to something else, then you'll 
be able to import the standard library `turtle` module.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue43483] Loss of content in simple (but oversize) SAX parsing

2021-03-17 Thread Eric V. Smith


Eric V. Smith  added the comment:

Could you give an example (using a list of callbacks and values or something) 
that shows how it's behaving that you think is problematic? That's the part I'm 
not understanding. This doesn't have to be a real example, just show what the 
user is getting that's not obvious to the normal user.

--

___
Python tracker 

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



[issue43531] Turtle module does not work

2021-03-17 Thread Adrian LeDeaux


New submission from Adrian LeDeaux :

So when I try to do the command "import turtle" all I get back is: 

Traceback (most recent call last):
  File "", line 1, in 
import turtle
  File "/Users/Virsatech/Documents/turtle.py", line 2, in 
t = turtle.Pen()
AttributeError: partially initialized module 'turtle' has no attribute 'Pen' 
(most likely due to a circular import)

that error exactly. And I have tried many times. Anyone know how to fix?

--
assignee: terry.reedy
components: IDLE
messages: 388931
nosy: aledeaux, terry.reedy
priority: normal
severity: normal
status: open
title: Turtle module does not work
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue39511] [subinterpreters] Per-interpreter singletons (None, True, False, etc.)

2021-03-17 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue43483] Loss of content in simple (but oversize) SAX parsing

2021-03-17 Thread Larry Trammell


Larry Trammell  added the comment:

Assuming that my understanding is completely correct, the situation is that the 
xml parser has an unspecified behavior.  This is true in any text content 
handler, at any time, and applies to the expat parser as well as SAX. In some 
rare cases, the behavior of the current implementation (and also many past 
ones) sometimes seems inconsistent and can catch users by surprise -- even some 
who are relatively knowledgable (which does not include me). 

This is a little abstract, but two things could be done to improve this:

1. Modify the implementation so that the behavior remains unspecified but falls 
more in line with plausible expectations of the users.  This makes things a 
little more complicated for the implementer, but does not invalidate the 
documentation of present or past versions. 

2. The documentation could be updated to expose the new constraints on the 
previously unspecified behavior, giving users a better chance to recognize and 
prepare for any remaining difficulties.  However, the implementation changes 
could be made even without these documentation changes.

So I remain confused about whether this is really a "bug" -- it is an "easy but 
unfortunate implementation choice" that is technically not wrong, even if 
sometimes baffling.  Established applications that already use older parser 
versions are relatively unlikely to start failing given the kind of documents 
they process, so backport changes might be helpful but do not seem urgent. 

Eric, with this clarification, what is your opinion about how to properly post 
a new issue -- improvement or bug fix?  I can provide a more detailed technical 
explanation where a new issue is posted.

--

___
Python tracker 

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



[issue43530] email.parser.BytesParser failed to parse mail when it is with BOM

2021-03-17 Thread tzing


New submission from tzing :

Python's builtin `email.parser.BytesParser` could not properly parse the 
message when the bytes starts with BOM.

Not 100% ensured- but this issue seems cause by that `FeedParser._parsegen` 
could not match any of the header line after the data is decoded.

Steps to reproduce:
1. get email sample. any from 
https://github.com/python/cpython/tree/master/Lib/test/test_email/data. I use 
msg_01.txt in following code
2. re-encoded the mail sample to some encoding with BOM
3. use `email.parser.BytesParser` to parse it

```py
import email
with open('msg_01.txt', 'rb') as fp:
msg = email.parser.BytesParser().parse(fp)
print(msg.get('Message-ID'))
```

Expect output `<15090.61304.110929.45...@aaa.zzz.org>`, got `None`

--
components: Library (Lib)
messages: 388929
nosy: tzing
priority: normal
severity: normal
status: open
title: email.parser.BytesParser failed to parse mail when it is with BOM
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



[issue43529] pathlib.Path.glob causes OSError encountering symlinks to long filenames

2021-03-17 Thread Eric Frederich


Eric Frederich  added the comment:

I verified against all versions available for me to select.
For 3.10 I used the 3.10-rc Docker image.

--
versions: +Python 3.10, Python 3.6, Python 3.7

___
Python tracker 

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



[issue43529] pathlib.Path.glob causes OSError encountering symlinks to long filenames

2021-03-17 Thread Eric Frederich


Change by Eric Frederich :


--
versions: +Python 3.8, Python 3.9

___
Python tracker 

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



[issue43529] pathlib.Path.glob causes OSError encountering symlinks to long filenames

2021-03-17 Thread Eric Frederich


New submission from Eric Frederich :

Calling pathlib.Path.glob("**/*) on a directory containing a symlink which 
resolves to a very long filename causes OSError.

This is completely avoidable since symlinks are not followed anyway.

In pathlib.py, the _RecursiveWildcardSelector has a method _iterate_directories 
which first calls entry.is_dir() prior to excluding based on entry.is_symlink().

It's the entry.is_dir() which is failing.
If the check for entry.is_symlink() were to happen first this error would be 
avoided.

It's worth noting that on Linux "ls -l bad_link" works fine.
Also "find /some/path/containing/bad/link" works fine.
You do get an error however when running "ls bad_link"
I believe Python's glob() should act like "find" on Linux and not fail.
Because it is explicitly ignoring symlinks anyway, it has no business calling 
is_dir() on a symlink.

I have attached a file which reproduces this problem.  It's meant to be ran 
inside of an empty directory.

--
files: uhoh.py
messages: 388927
nosy: eric.frederich
priority: normal
severity: normal
status: open
title: pathlib.Path.glob causes OSError encountering symlinks to long filenames
Added file: https://bugs.python.org/file49884/uhoh.py

___
Python tracker 

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



[issue29687] smtplib does not support proxy

2021-03-17 Thread Ryan Hiebert


Change by Ryan Hiebert :


--
nosy: +ryanhiebert

___
Python tracker 

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



[issue43512] Bug in isinstance(instance, cls) with cls being a protocol? (PEP 544)

2021-03-17 Thread Guido van Rossum


Guido van Rossum  added the comment:

Yes, discussion on a close issue is still read, unless people explicitly
unsubscribe (which they rarely do unless the chatter is spam).

--

___
Python tracker 

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



[issue43284] Inability to fetch build 20H2

2021-03-17 Thread Steve Dower


Steve Dower  added the comment:

Yeah, that all makes sense. 90%+ of the time, checking the version number is a 
compatibility issue waiting to happen.

For the other 10% (diagnostic logging), it would be nice to have a better 
option than running "cmd /c ver", but that might be the easiest thing to do. 
I'd want to remove any pretence that the returned version is a comparable 
number, and I'm not sure how easily we can do that without hurting 
compatibility...

--

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-17 Thread Eric Snow


Eric Snow  added the comment:

FYI, I'm going to focus discussion on the capi-sig thread.

--

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-17 Thread Eric Snow


Eric Snow  added the comment:

> PEP 489 is *very much* part of the limited API.

Gah, I missed that.  That said, I don't think it matters; I just lose an easy 
point in the rationale. :)

--

___
Python tracker 

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



  1   2   >