[issue32424] Synchronize copy methods between Python and C implementations of xml.etree.ElementTree.Element

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:


New changeset 50fed0b64faa305338ef5607b570fe209de6 by Stefan Behnel (Gordon 
P. Hemsley) in branch 'master':
bpo-32424: Improve test coverage for xml.etree.ElementTree (GH-12891)
https://github.com/python/cpython/commit/50fed0b64faa305338ef5607b570fe209de6


--

___
Python tracker 

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



[issue35070] test_posix fails on macOS 10.14 Mojave

2019-04-27 Thread Jeffrey Kintscher


Jeffrey Kintscher  added the comment:

My mistake. It still failed with gcc 8.3.0.

--

___
Python tracker 

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



[issue36744] functools.singledispatch: Shouldn't require a positional argument if there is only one keyword argument

2019-04-27 Thread Kevin


Kevin  added the comment:

I have read issue33967 before posting this one.

The error message was introduced there, but the behavior hasn't changed.

The problem that issue33967 solves is that while singledispatch requires at 
least one positional argument, there was no explicit error message that told 
you that when you didn't pass any.

What this issue is about, is that singledispatch could also work without 
positional arguments IF only one keyword argument is provided.

--

___
Python tracker 

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



[issue26978] Implement pathlib.Path.link (Using os.link)

2019-04-27 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

This looks same as https://bugs.python.org/issue28608

--
nosy: +xtreak
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue36744] functools.singledispatch: Shouldn't require a positional argument if there is only one keyword argument

2019-04-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This was introduced as part of issue33967.

--
nosy: +doerwalter, inada.naoki, lukasz.langa, xtreak

___
Python tracker 

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



[issue26835] Add file-sealing ops to fcntl

2019-04-27 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue26978] Implement pathlib.Path.link (Using os.link)

2019-04-27 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
keywords: +patch
pull_requests: +12913
stage:  -> patch review

___
Python tracker 

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



[issue36744] functools.singledispatch: Shouldn't require a positional argument if there is only one keyword argument

2019-04-27 Thread Kevin


New submission from Kevin :

Passing a single argument as a keyword argument to a function decorated with 
@functools.singledispatch results in an error:

$ python
Python 3.7.2 (default, Feb 12 2019, 08:15:36) 
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from functools import singledispatch
>>> @singledispatch
... def f(x):
...   pass
... 
>>> f(x=1)
Traceback (most recent call last):
  File "", line 1, in 
  File "/lib/python3.7/functools.py", line 821, in wrapper
raise TypeError(f'{funcname} requires at least '
TypeError: f requires at least 1 positional argument

I think it's reasonable to expect f(x=1) to do the same as f(1) in this case. 
Since there is only one argument, it should be the one passed to dispatch().

Relevant code:
def wrapper(*args, **kw):
  if not args:
  raise TypeError(f'{funcname} requires at least '
  '1 positional argument')

  return dispatch(args[0].__class__)(*args, **kw)

https://github.com/python/cpython/blob/445f1b35ce8461268438c8a6b327ddc764287e05/Lib/functools.py#L819-L824

I think the wrapper method could use something like next(iter(d.values())) 
instead of args[0] when there are no args, but exactly one keyword argument.

I am happy to make the change myself

--
components: Library (Lib)
messages: 341016
nosy: KevinG, rhettinger
priority: normal
severity: normal
status: open
title: functools.singledispatch: Shouldn't require a positional argument if 
there is only one keyword argument
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



[issue15388] SAX parse (ExpatParser) leaks file handle when given filename input

2019-04-27 Thread Berker Peksag


Berker Peksag  added the comment:

I just tested the snippet in msg165779 under Windows with Python 2.7.16. I 
didn't get WindowsError after I called os.unlink(path) and verified that path 
is removed from the file system.

I think we can close this issue as 'out of date'.

--
nosy: +berker.peksag
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



[issue22640] Add silent mode for py_compile

2019-04-27 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue21536] extension built with a shared python cannot be loaded with a static python

2019-04-27 Thread Xavier de Gaye


Xavier de Gaye  added the comment:

PR 12989 fixes the Android issue and has been checked on the Android emulator 
at API 24.

Python is cross-compiled with '--enable-shared' and the python-config scripts 
give the expected result:

generic_x86_64:/data/local/tmp/python/bin $ python -c "from sysconfig import 
get_config_var; print(get_config_var('Py_ENABLE_SHARED'))"   
1
generic_x86_64:/data/local/tmp/python/bin $ sh python-config --libs 
   
-lpython3.8d -ldl  -lm -lm 
generic_x86_64:/data/local/tmp/python/bin $ python python-config.py --libs  
   
-lpython3.8d -ldl -lm -lm

--

___
Python tracker 

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



[issue2091] file accepts 'rU+' as a mode

2019-04-27 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset f5972cc0c9a8e3315207e2d67534f330d619af4e by Berker Peksag (Miss 
Islington (bot)) in branch '3.7':
bpo-2091: Fix typo in exception message (GH-12987)
https://github.com/python/cpython/commit/f5972cc0c9a8e3315207e2d67534f330d619af4e


--

___
Python tracker 

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



[issue21536] extension built with a shared python cannot be loaded with a static python

2019-04-27 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
pull_requests: +12912
stage: resolved -> patch review

___
Python tracker 

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



[issue36025] Breaking change in PyDate_FromTimeStamp API

2019-04-27 Thread Berker Peksag


Change by Berker Peksag :


--
resolution:  -> fixed
stage: patch review -> 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



[issue36741] Variable about function and list

2019-04-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

No problem, closing this as not a bug.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: compile error -> behavior

___
Python tracker 

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



[issue36741] Variable about function and list

2019-04-27 Thread 張晨韜

張晨韜  added the comment:

Sorry. This is my first time to use this.Next time I'll notice.
Thanks a lot for your fast and patient answer.

--

___
Python tracker 

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



[issue2091] file accepts 'rU+' as a mode

2019-04-27 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12911

___
Python tracker 

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



[issue2091] file accepts 'rU+' as a mode

2019-04-27 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 21a9ba1992775b5a833da28bfa0a9f028d1b6761 by Berker Peksag in 
branch 'master':
bpo-2091: Fix typo in exception message (GH-12987)
https://github.com/python/cpython/commit/21a9ba1992775b5a833da28bfa0a9f028d1b6761


--
nosy: +berker.peksag

___
Python tracker 

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



[issue36025] Breaking change in PyDate_FromTimeStamp API

2019-04-27 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 4d8c8c0ad6163c24136d3419eb04f310b31f7e64 by Berker Peksag (Paul 
Ganssle) in branch 'master':
bpo-36025: Fix PyDate_FromTimestamp API (GH-11922)
https://github.com/python/cpython/commit/4d8c8c0ad6163c24136d3419eb04f310b31f7e64


--
nosy: +berker.peksag

___
Python tracker 

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



[issue36722] In debug build, load also C extensions compiled in release mode or compiled using the stable ABI

2019-04-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5c403b203510549a3f89d138d3265c5cc0cc12af by Victor Stinner (Paul 
Ganssle) in branch 'master':
bpo-36722: Style and grammar edits for ABI news entries (GH-12979)
https://github.com/python/cpython/commit/5c403b203510549a3f89d138d3265c5cc0cc12af


--

___
Python tracker 

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



[issue21403] cElementTree's Element creation handles attrib argument different from ET

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

Let's not change this in Py2 anymore.

--
resolution:  -> wont fix
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



[issue33303] ElementTree Comment text isn't escaped

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

Yes, comment text should be escaped internally like all other text, not by the 
user. The same applies to processing instructions.

This suggests that it's probably also untested currently. Could you provide a 
PR for that changes both and adds tests?

--
stage:  -> needs patch
versions: +Python 3.8 -Python 2.7, 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



[issue15388] SAX parse (ExpatParser) leaks file handle when given filename input

2019-04-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Is this fixed with d81f9e24ea89c0aaded1e0d3f8d8076bbd58c19a ?

--
nosy: +scoder, serhiy.storchaka, xtreak

___
Python tracker 

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



[issue36742] urlsplit doesn't accept a NFKD hostname with a port number

2019-04-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This could be due to issue36216.

--
nosy: +steve.dower, xtreak

___
Python tracker 

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



[issue2091] file accepts 'rU+' as a mode

2019-04-27 Thread Berker Peksag


Change by Berker Peksag :


--
pull_requests: +12910

___
Python tracker 

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



[issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

Closing as a duplicate of the more general issue 18304.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> ElementTree -- provide a way to ignore namespace in tags and 
searches

___
Python tracker 

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



[issue35502] Memory leak in xml.etree.ElementTree.iterparse

2019-04-27 Thread STINNER Victor


STINNER Victor  added the comment:

The 3.6 branch no longer accept bugfixes.

--

___
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

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

I don't think there is a need for a close() method. Instead, the iterator 
should close the file first thing when it's done with it, but only if it owns 
it. Therefore, the fix in issue 25688 seems correct.

Closing can also be done explicitly in a finaliser of the iterator, if implicit 
closing via decref is too lax.

--
nosy: +scoder
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue35502] Memory leak in xml.etree.ElementTree.iterparse

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

This ticket looks like it's done for 3.7/8. Can it be closed?
I guess 3.6 isn't relevant anymore, right?

--

___
Python tracker 

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



[issue36737] Warnings operate out of global runtime state.

2019-04-27 Thread Eric Snow


Eric Snow  added the comment:

Good point.

Also, the whole idea of inheriting things (settings, some copied objects, etc.) 
into subinterpreters is interesting.  My initial reaction is that folks would 
appreciate that feature, at least for a handful of things.  It's not critical, 
but is worth adding to the list of deferred ideas in PEP 554. :)

--

___
Python tracker 

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



[issue28460] Minidom, order of attributes, datachars

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

I'll close this as a duplicate of issue 34160.

I'm aware that you also proposed to reduce the text escaping, but it's still 
needed for attribute values. Not sure if it's really worth having two different 
escape functions. Feel free to provide a PR and create a new ticket for this, 
so that we can discuss a specific change proposal. It's not good to discuss 
more than one topic per ticket.

--
nosy: +scoder
superseder:  -> ElementTree not preserving attribute order

___
Python tracker 

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



[issue36741] Variable about function and list

2019-04-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

You are passing a reference to the list so changes in Flash are made to the 
actual variable. Using cards.copy() instead of cards passes a copy of the list 
and hence modifications inside the function won't affect the original list.

This is not a bug in CPython and it's more suited python-tutor mailing list. 
Also in future bug reports please paste the program and output than images.

Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue9521] xml.etree.ElementTree skips processing instructions when parsing

2019-04-27 Thread Stefan Behnel


Change by Stefan Behnel :


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

___
Python tracker 

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



[issue36743] Docs: Descript __get__ signature defined differently across the docs

2019-04-27 Thread Jon Dufresne


New submission from Jon Dufresne :

Here: https://docs.python.org/3/reference/datamodel.html#object.__get__

The __get__ signature is defined as:

object.__get__(self, instance, owner)

But here: https://docs.python.org/3/howto/descriptor.html#descriptor-protocol

It is defined as:

descr.__get__(self, obj, type=None)

It is not clear to me as a reader if all descriptors should have the owner/type 
argument default to None or if it should be required. If it should default to 
None, I think all doc examples should follow this expectation to make it clear 
to someone implementing a descriptor for the first time. As best I can tell, 
the owner/type is always passed. So perhaps the =None shouldn't be there.

Grepping the CPython code, I see lots of definitions for both required and 
optional, adding more confusion for me.

If there is a definitive answer, I'm happy to follow through by updating the 
docs.

--
assignee: docs@python
components: Documentation
messages: 341004
nosy: docs@python, jdufresne
priority: normal
severity: normal
status: open
title: Docs: Descript __get__ signature defined differently across the docs
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue36743] Docs: Descript __get__ signature defined differently across the docs

2019-04-27 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-27 Thread Eric Snow


Eric Snow  added the comment:

FWIW, I don't mean to side-track this issue.  If we want to have any further 
discussion about broader solutions then let's take this to capi-sig.  In fact, 
I've started a thread there.  I'd post the link, but I think it got stuck in 
moderation. :)

--

___
Python tracker 

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



[issue1613500] Write mode option for fileinput module.

2019-04-27 Thread Berker Peksag


Change by Berker Peksag :


--
pull_requests: +12909

___
Python tracker 

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



[issue9521] xml.etree.ElementTree skips processing instructions when parsing

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

Issue 24287 is a duplicate of this one and has some additional discussion.

--

___
Python tracker 

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



[issue32235] test_xml_etree test_xml_etree_c failures with 2.7 and 3.6 branches 20171205

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

Closing as outdated / third-party.

--
nosy: +scoder
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



[issue35502] Memory leak in xml.etree.ElementTree.iterparse

2019-04-27 Thread Stefan Behnel


Change by Stefan Behnel :


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



[issue18304] ElementTree -- provide a way to ignore namespace in tags and searches

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

Coming back to this issue after a while, I think it's still a relevant problem 
in some use cases. However, it's not currently clear what an improved solution 
would look like. The fully qualified tag names in Clark notation are long, 
sure, but also extremely convenient in being explicit and fully self-contained.

One thing I noticed is that the examples used in this and other reports usually 
employ the .find() methods. Maybe issues 28238 and 30485 can reduce the pain to 
an acceptable level?


Regarding the specific proposals:

> root.xmlns_at_root.append('{namespace}')

This cannot work since searches from a child element would then not know about 
the prefix. Elements in ElementTree do not have a global tree state.


> 2. Leave the abbreviation colon-separated prefix in front of the element tags 
> as they come in.

Note that prefixes are only indirections. They do not have a meaning by 
themselves and multiple prefixes can (and often do) refer to the same 
namespace. Moving the prefix resolution from the parser to the users seems to 
make the situation worse instead of better.

--
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue36739] "4.6. Defining Functions" should mention nonlocal

2019-04-27 Thread Peter Bauer


Change by Peter Bauer :


--
keywords: +patch
pull_requests: +12908
stage: needs patch -> patch review

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-27 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

Changing *every* C API function to include a state parameter looks very 
cumbersome. Another alternative would be to store the interpreter state in 
every Python object (or every class, that would be sufficient). That way, you 
would only need to pass context to C API functions which do not take a Python 
object as argument.

--

___
Python tracker 

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



[issue18675] Daemon Threads can seg fault

2019-04-27 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> wont fix
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



[issue14149] argparse: Document how to use argument names that are not Python identifiers

2019-04-27 Thread Fred L. Drake, Jr.


Change by Fred L. Drake, Jr. :


--
versions: +Python 3.7, Python 3.8, Python 3.9 -Python 3.2, Python 3.3

___
Python tracker 

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



[issue35360] Update SQLite to 3.26 in Windows and macOS installer builds

2019-04-27 Thread Big Stone


Big Stone  added the comment:

sqlite-3.28.0 now available, with extended window functio support: EXCLUDE 
clause, GROUPS frame types, window chaining, and support for " PRECEDING" 
and " FOLLOWING" boundaries in RANGE frames.

--
nosy: +Big Stone

___
Python tracker 

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



[issue24287] Let ElementTree prolog include comments and processing instructions

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

This is a duplicate of 9521, but it's difficult to say which ticket is better.

--

___
Python tracker 

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



[issue36739] "4.6. Defining Functions" should mention nonlocal

2019-04-27 Thread Peter Bauer


Peter Bauer  added the comment:

ok, will try to create a pull-request for that, although i'm not a natural 
englishman...

--

___
Python tracker 

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



[issue18304] ElementTree -- provide a way to ignore namespace in tags and searches

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

I was referring to issue 28238 and issue 30485.

--

___
Python tracker 

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



[issue5166] ElementTree and minidom don't prevent creation of not well-formed XML

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

This is a tricky decision. lxml, for example, validates user input, but that's 
because it has to process it anyway and does it along the way directly on input 
(and very efficiently in C code). ET, on the other hand, is rather lenient 
about what it allows users to do and doesn't apply much processing to user 
input. It even allows invalid trees during processing and only expects the tree 
to be serialisable when requested to serialise it.

I think that's a fair behaviour, because most user input will be ok and 
shouldn't need to suffer the performance penalty of validating all input. 
Null-characters are a very rare thing to find in text, for example, and I think 
it's reasonable to let users handle the few cases by themselves where they can 
occur.

Note that simply replacing invalid characters by the replacement character is 
not a good solution, at least not in the general case, since it silently 
corrupts data. It's probably a better solution for users to make their code 
scream out loudly when it has to deal with data that it cannot serialise in the 
end, and to do that early on input (where its easy to debug) rather than late 
on serialisation where it might be difficult to understand how the data became 
what it is. Trying to serialise a null-character seems only a symptom of a more 
important problem somewhere else in the processing pipeline.

In the end, users who *really* care about correct output should run some kind 
of schema validation over it *after* serialisation, as that would detect not 
only data issues but also structural and logical issues (such as a missing or 
empty attribute), specifically for their target data format. In some cases, it 
might even detect random data corruption due to old non-ECC RAM in the server 
machine. :)

So, if someone finds a way to augment the text escaping procedure with a bit of 
character validation without making it slower (especially for the extremely 
common very short strings), then I think we can reconsider this as an 
enhancement. Until then, and seeing that no-one has come up with a patch in the 
last 10 years, I'll close this as "won't fix".

--
dependencies:  -Document Object Model API - validation
nosy: +scoder
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed
versions: +Python 3.8 -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



[issue1776160] Buffer overflow when listing deeply nested directory

2019-04-27 Thread Eryk Sun


Eryk Sun  added the comment:

In Windows 7, FindFirstFileA uses a per-thread static buffer to decode the 
input bytes path to Unicode. This buffer limits the length to 259 characters 
(MAX_PATH - 1), even if a "\\?\" device path is used. Windows 8+ uses a dynamic 
buffer, but I don't see the point of switching to a  dynamic buffer on our side 
given Windows 7 is still so widely used and the documentation still requires 
Unicode for long "\\?\" paths. 

Ideally, I think 2.7 should raise the same exception as 3.5 does in this case 
[1]. For example:

>>> os.listdir(long_bytes_path)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: listdir: path too long for Windows

[1]: https://github.com/python/cpython/blob/v3.5.7/Modules/posixmodule.c#L928

--
nosy: +eryksun

___
Python tracker 

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



[issue36736] Python crashes when calling win32file.LockFileEx

2019-04-27 Thread Eryk Sun


Eryk Sun  added the comment:

> win32file.LockFileEx(h, win32con.LOCKFILE_EXCLUSIVE_LOCK, 5, 5, None)

This is a third-party issue in the PyWin32 package. win32file.LockFileEx 
shouldn't allow passing None for the required 5th parameter `ol` (i.e. the 
lpOverlapped parameter of WINAPI LockFileEx [1]). Or at least it should 
allocate a default overlapped record in this case, with the offset set to 0. 
Passing a NULL pointer leads to an access-violation exception.

[1]: 
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-lockfileex

FYI, setting a lock on the file is unecessary in this case. You created the 
kernel file object without data-access sharing (i.e. shareMode == 0). Until the 
handle is closed, opening the file again with read or write data access will 
fail as a sharing violation (32).

--
nosy: +eryksun
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue36737] Warnings operate out of global runtime state.

2019-04-27 Thread Steve Dower


Steve Dower  added the comment:

> I could also see use cases for *also* configuring warnings process-wide but 
> that could be handled separately if actually desired.

Beyond "warning configuration is inherited by new interpreters", I don't see 
any reason to have process wide configuration. People using Python directly 
will get "process" wide from runtime configuration, and embedders don't want 
anything implicitly process-wide at all.

--

___
Python tracker 

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



[issue24287] Let ElementTree prolog include comments and processing instructions

2019-04-27 Thread Stefan Behnel


Change by Stefan Behnel :


--
superseder:  -> xml.etree.ElementTree skips processing instructions when parsing

___
Python tracker 

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



[issue28460] Minidom, order of attributes, datachars

2019-04-27 Thread Stefan Behnel


Change by Stefan Behnel :


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



[issue9521] xml.etree.ElementTree skips processing instructions when parsing

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

Ticket 24287 is a duplicate of this one and has some additional discussion.

--

___
Python tracker 

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



[issue21536] extension built with a shared python cannot be loaded with a static python

2019-04-27 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue for the Android case.

I am fine with having a different linking policy per platform. For example, 
Windows has a different policy than Linux. We can continue to link C extensions 
to libpython on Android. The ability to load release C extension in debug 
Python is a feature more for debugging. I am not sure that Android is the best 
platform for debugging anyway. The debug can be done on a desktop Linux for 
example, no?

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue36735] minimize disk size of cross-compiled python3.6

2019-04-27 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xdegaye

___
Python tracker 

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



[issue36741] Variable about function and list

2019-04-27 Thread 張晨韜

New submission from 張晨韜 :

Hello,I'm a Taiwanese student.
First,I will say sorry because of my poor English.If I have an offense,please 
forgive me.
Then,look at the picture about program.I declare a list "cards" to the function 
"Flush",and divide them by 13 in the function.The function Flash will return 
boolean finally. After that,I write "main" which declare a list and call 
"Flush" for it to show what value it is.However,when I print this list 
again,its value will be changed.
I'm confused that isn't Flush.cards a local variable belong to Flush? Why Flush 
can change the list's value for the other function without return? I asked my 
friend and he was confused,too.So I send this issue and hope to know why it 
is.Thanks.

--
components: Windows
files: 未命名.png
messages: 340982
nosy: paul.moore, steve.dower, tim.golden, zach.ware, 張晨韜
priority: normal
severity: normal
status: open
title: Variable about function and list
type: compile error
versions: Python 3.6
Added file: https://bugs.python.org/file48288/未命名.png

___
Python tracker 

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



[issue36735] minimize disk size of cross-compiled python3.6

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

Make sure you use CFLAGS that limit the amount of debug data in the binaries. 
"-g1" in gcc should be enough to get stack traces on crashes, while reducing 
the binaries quite considerably compared to the default. "-g0" will give 
another visible reduction but removes all debug symbols, thus making it 
difficult to diagnose problems remotely.

Apart from that, there used to be support for stuffing the standard library 
into a zip file, which shrinks .py and .pyc files by a good margin. Not sure 
what the status of that is, though, since I never needed it.

And finally, I'm not sure if this is worth a (bug) ticket, rather than starting 
a discussion on python-list. Since this is a usage and deployment issue, the 
larger audience there might have more ideas and experience with things that 
might work without changing CPython for it. In any case, there will be no 
changes from the CPython side for this regarding Python 3.6. Anything this 
ticket might result in would be targeted for a future yet-to-be-released Python 
version.

--
nosy: +scoder

___
Python tracker 

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



[issue36694] Excessive memory use or memory fragmentation when unpickling many small objects

2019-04-27 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue13272] 2to3 fix_renames doesn't rename string.lowercase/uppercase/letters

2019-04-27 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue10789] Lock.acquire documentation is misleading

2019-04-27 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue36739] "4.6. Defining Functions" should mention nonlocal

2019-04-27 Thread Peter Bauer


New submission from Peter Bauer :

In the fourth paragraph, the sentence 

"Thus, global variables cannot be directly assigned a value within a function 
(unless named in a global statement)"

should somehow be extended to mention the nonlocal-statements:

Thus, global variables or variables of enclosing functions cannot be directly 
assigned a value within a function (unless named in a global statement (for 
global variables) or named in a nonlocal statement (for variables of enclosing 
functions)

--
assignee: docs@python
components: Documentation
messages: 340963
nosy: docs@python, pbhd0815
priority: normal
severity: normal
status: open
title: "4.6. Defining Functions" should mention nonlocal
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



[issue23163] pdb docs need to contain a statement on threads/multithreaded debugging

2019-04-27 Thread daniel hahler


Change by daniel hahler :


--
nosy: +blueyed

___
Python tracker 

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



[issue10328] re.sub[n] doesn't seem to handle /Z replacements correctly in all cases

2019-04-27 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue36740] zipimporter misses namespace packages for implicit dirs

2019-04-27 Thread Jason R. Coombs


New submission from Jason R. Coombs :

As discovered in https://github.com/pypa/packaging-problems/issues/212, if a 
PEP 420 namespace package is represented by an implicit directory (that is, 
there's no explicit entry for the directory, only entries for the contents of 
the directory), that directory won't be picked up as a namespace package. The 
following code illustrates the issue:

```
zp $ cat make-pkgs.py   

   
import zipfile


def make_pkgs():
zf = zipfile.ZipFile('simple.zip', 'w')
zf.writestr('pkg/__init__.py', b'')
zf.close()

zf = zipfile.ZipFile('namespace.zip', 'w')
zf.writestr('ns/pkg/__init__.py', b'')
zf.close()


__name__ == '__main__' and make_pkgs()
zp $ python make-pkgs.py

   
zp $ env PYTHONPATH=simple.zip python3.7 -c "import pkg"

   
zp $ env PYTHONPATH=namespace.zip python3.7 -c "import ns.pkg"  

   
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'ns'
```

As you can see, in simple.zip, the `pkg` directory is implied, but despite that 
condition, `pkg` is importable.

However, with namespace.zip, the name `ns` is not visible even though it's 
present in the zipfile and would be importable if that zipfile were extracted 
to a file system.

```
zp $ unzip namespace.zip
Archive:  namespace.zip
 extracting: ns/pkg/__init__.py
zp $ python3.7 -c "import ns.pkg" && echo done
done
```

If you were to reconstruct that zip file on the file system using standard 
tools or explicitly include 'ns/' in the zip entries, the namespace package 
becomes visible:

```
zp $ rm namespace.zip   

   
zp $ zip -r namespace.zip ns

   
  adding: ns/ (stored 0%)
  adding: ns/pkg/ (stored 0%)
  adding: ns/pkg/__init__.py (stored 0%)
  adding: ns/pkg/__pycache__/ (stored 0%)
  adding: ns/pkg/__pycache__/__init__.cpython-37.pyc (deflated 23%)
zp $ rm -r ns   

   
zp $ env PYTHONPATH=namespace.zip python3.7 -c "import ns.pkg" && echo done 

   
done
```

For consistency, the zip import logic should probably honor implicit 
directories in zip files.

--
components: Library (Lib)
messages: 340975
nosy: jaraco
priority: normal
severity: normal
status: open
title: zipimporter misses namespace packages for implicit dirs
type: behavior

___
Python tracker 

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



[issue36679] duplicate method definition in Lib/test/test_genericclass.py

2019-04-27 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
status: closed -> open

___
Python tracker 

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



[issue36738] Add 'array_hook' for json module

2019-04-27 Thread matt farrugia


Change by matt farrugia :


--
keywords: +patch
pull_requests: +12906
stage:  -> patch review

___
Python tracker 

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



[issue36742] urlsplit doesn't accept a NFKD hostname with a port number

2019-04-27 Thread Chihiro Ito

New submission from Chihiro Ito :

urllib.parse.urlsplit raises an exception for an url including a non-ascii 
hostname in NFKD form and a port number.

example:
>>> urlsplit('http://\u30d5\u309a:80')
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/ito/.maltybrew/deen/lib/python3.7/urllib/parse.py", line 437, in 
urlsplit
_checknetloc(netloc)
  File "/Users/ito/.maltybrew/deen/lib/python3.7/urllib/parse.py", line 407, in 
_checknetloc
"characters under NFKC normalization")
ValueError: netloc 'プ:80' contains invalid characters under NFKC normalization
>>> urlsplit('http://\u30d5\u309a')
SplitResult(scheme='http', netloc='プ', path='', query='', fragment='')
>>> urlsplit(unicodedata.normalize('NFKC', 'http://\u30d5\u309a:80'))
SplitResult(scheme='http', netloc='プ:80', path='', query='', fragment='')

I believe this behavior was introduced at Python 3.7.3. Python 3.7.2 doesn't 
raise any exception for these lines.

--
components: Unicode
messages: 340983
nosy: ezio.melotti, hokousya, vstinner
priority: normal
severity: normal
status: open
title: urlsplit doesn't accept a NFKD hostname with a port number
versions: Python 3.7

___
Python tracker 

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



[issue36679] duplicate method definition in Lib/test/test_genericclass.py

2019-04-27 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset d111490a1f63db2dcc3714157726dc6a5c0fa1cd by Ivan Levkivskyi in 
branch '3.7':
[3.7] bpo-36679: Rename duplicate test_class_getitem function (GH-12892) 
(GH-12978)
https://github.com/python/cpython/commit/d111490a1f63db2dcc3714157726dc6a5c0fa1cd


--

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-27 Thread Steve Dower


Steve Dower  added the comment:

Changing every API to take the context parameter would bring us into alignment 
with the JavaScript VMs.

I'm working on a project that embeds a few of these, as well as Python, and our 
thread management is much worse than their context parameter. Though I'm of 
course very sympathetic to the compatibility argument (but then the shims would 
just load the context from TSS and pass it around, so they're not too bad).

Eric's breakdown of context scopes seems spot on, and it means that we only 
really need the thread state to be passed around. The few places that would be 
satisfied by runtime state now (GIL, GC) should become interpreter state, which 
is most easily found from a thread state anyway.

Runtime state should eventually probably become runtime configuration (those 
settings we need to create interpreters) and a minimum amount of state to track 
live interpreters. I see no reason to pass it around anywhere other than 
interpreter creation, and as a transitional step toward that goal it should be 
accessible through the active interpreter state.

--

___
Python tracker 

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



[issue22640] Add silent mode for py_compile

2019-04-27 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
keywords: +patch
pull_requests: +12902
stage: needs patch -> patch review

___
Python tracker 

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



[issue36738] Add 'array_hook' for json module

2019-04-27 Thread matt farrugia


New submission from matt farrugia :

The json module allows a user to provide an `object_hook` function, which, if 
provided, is called to transform the dict that is created as a result of 
parsing a JSON Object.

It'd be nice if there was something analogous for JSON Arrays: an `array_hook` 
function to transform the list that is created as a result of parsing a JSON 
Array.

At the moment transforming JSON Arrays requires one of the following approaches 
(as far as I can see):

(1) Providing an object_hook function that will recursively transform any lists 
in the values of an Object/dict, including any nested lists, AND recursively 
transforming the final result in the event that the top level JSON object being 
parsed is an array (this array is never inside a JSON Object that goes through 
the `object_hook` transformation).
(2) Transforming the entire parsed result after parsing is finished by 
recursively transforming any lists in the final result, including recursively 
traversing nested lists AND nested dicts.

Providing an array_hook would cut out the need for either approach, as the 
recursive case from the recursive functions I mentioned could be used as the 
`array_hook` function directly (without the recursion).


## An example of usage:

Let's say we want JSON Arrays represented using tuples rather than lists, e.g. 
so that they are hashable straight out-of-the-(json)-box. Before this 
enhancement, this change requires one of the two methods I mentioned above. It 
is not so difficult to implement these recursive functions, but seems 
inelegant. After the change, `tuple` could be used as the `array_hook` directly:

```
>>> json.loads('{"foo": [[1, 2], "spam", [], ["eggs"]]}', array_hook=tuple)
{'foo': ((1, 2), 'spam', (), ('eggs',))}
```

It seems (in my opinion) this is more elegant than converting via an 
`object_hook` or traversing the whole structure after parsing.

## The patch:

I am submitting a patch that adds an `array_hook` kwarg to the `json` module's 
functions `load` and `loads`, and to the `json.decoder` module's `JSONDecoder`, 
`JSONArray` and `JSONObject` classes. I also hooked these together in the 
`json.scanner` module's `py_make_scanner` function.


It seems that `json.scanner` will prefer the `c_make_scanner` function defined 
in `Modules/_json.c` when it is available. I am not confident enough in my C 
skills or C x Python knowledge to dive into this module and make the analogous 
changes. But I assume they will be simple for someone who can read C x Python 
code, and that the changes will be analogous to those required to 
`Lib/json/scanner.py`. I need help to accomplish this part of the patch.


## Testing:

In the mean time, I added a test to `test_json.test_decode`. It's CURRENTLY 
FAILING because the implementation of the patch is incomplete (I believe this 
is only due to the missing part of the patch---the required changes to 
`Modules/_json.c` I identified above).

When I manually reset `json.scanner.make_scanner` to 
`json.scanner.py_make_scanner` and play around with the new `array_hook` 
functionality, it seems to work.

--
components: Extension Modules, Library (Lib)
messages: 340957
nosy: matomatical
priority: normal
severity: normal
status: open
title: Add 'array_hook' for json module
type: enhancement
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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2019-04-27 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

3.6 only gets security fixes.  This appears to be an enhancement request.  
SkipTest is an exception and according to the doc it should be propagated to 
the caller.  __unittest_skip__ is an undocumented internal name, so you 
probably should not be using it.

If this request is not rejected, we will need test code demonstrating the issue 
*that does not use zope*.

--
nosy: +terry.reedy
stage:  -> test needed
type: behavior -> enhancement
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue36675] Doctest directives and comments missing from code samples

2019-04-27 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I verified that the line in Doc/library/doctest.rst has the comment.
"
For example, this test passes::

   >>> print(list(range(20))) # doctest: +NORMALIZE_WHITESPACE
   [0,   1,  2,  3,  4,  5,  6,  7,  8,  9,
   10,  11, 12, 13, 14, 15, 16, 17, 18, 19]
"
However, the comment is omitted from the .html built on Windows by Sphinx 1.8.1.
"
 print(list(range(20))) 
   ***html for comment should be here***
[0,   1,  2,  3,  4,  5,  6,  7,  8,  9,
10,  11, 12, 13, 14, 15, 16, 17, 18, 19]


"
To me, this is a bug with building the .html for doctest.rst.  Comments are 
preserved elsewhere.  For instance, the code example for 
https://docs.python.org/3/library/functions.html#dir.  The .rst file has
"
   The resulting list is sorted alphabetically.  For example:

  >>> import struct
  >>> dir()   # show the names in the module namespace  # doctest: +SKIP
"
Both use 3-space colon + indents to mean 'example block'.  The only difference 
is '::' versus ':'.  https://devguide.python.org/documenting/#source-code says 
:: is required.  idle.rst also has a code example with comments displayed (I 
just submitted a PR to not suppress color highlighting.)

I leave it to the doc experts to discover why the comments are not included in 
doctest.html.

--
nosy: +eric.araujo, ezio.melotti, terry.reedy, willingc
stage:  -> needs patch
title: Doctest directives and comments not visible or missing from code samples 
-> Doctest directives and comments missing from code samples
versions: +Python 2.7, 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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2019-04-27 Thread Eric Snow


Eric Snow  added the comment:

I don't think this change is the right way to go (yet), but something related 
might be.  First, let's be clear on the status quo for CPython.  (This has 
gotten long, but I want to be clear.)


Status Quo


For simplicity sake, let's say nearly all the code operates relative to the 3 
levels of runtime state:

* global  - _PyRuntimeState
* interpreter - PyInterpreterState
* thread  - PyThreadState

Furthermore, there are 3 groups of functions in the C-API:

* context-sensitive   - operate relative to the current Python thread
* runtime-dependent   - operate relative to some part of the runtime state, 
regardless of thread
* runtime-independent - have nothing to do with CPython's runtime state

Most of the C-API is context-sensitive.  A small portion is runtime-dependent.  
A handful of functions are runtime-independent (effectively otherwise stateless 
helper functions that only happen to be part of the C-API).

Each context-sensitive function relies on there being a "runtime context" it 
can use relative to the current OS thread.  That context consists of the 
current (i.e. active) PyThreadState, the corresponding PyInterpreterState, and 
the global _PyRuntimeState.  That context is derived from data in TSS (see 
caveats below).  This group includes most of the C-API.

Each runtime-dependent function operates against one or more runtime state 
target, regardless of the current thread context (or even if there isn't one).  
The target state (e.g. PyInterpreterState) is always passed explicitly.  Again, 
this is only a small portion of the C-API.

Caveats:
* for context-sensitive functions, we get the global runtime state from the 
global C variable (_PyRuntime) rather than via the implicit thread context
* for some of the runtime-dependent functions that target _PyRuntimeState, we 
rely on the global C variable

All of this is the pattern we use currently.  Using TSS to identify the 
implicit runtime context has certain benefits and costs:

benefits:
* sticking with the status quo means no backward incompatibility for existing 
C-extension code
* easier to distinguish the context-sensitive functions from the 
runtime-dependent ones
* (debatable) callers don't have to track, nor pass through, an extra argument

costs:
* extra complexity in keeping TSS correct
* makes the C-API bigger (extra macros, etc.)


Alternative
=

For every context-sensitive function we could add a new first parameter, 
"context", that provides the runtime context to use.  That would be something 
like this:

struct {
PyThreadState *tstate;
...
} PyRuntimeContext;

The interpreter state and global runtime state would still be accessible via 
the same indirection we have now.

Taking this alternative would eliminate the previous costs.  Having a 
consistent "PyRuntimeContext *context" first parameter would maintain the easy 
distinction from runtime-dependent functions.  Asking callers to pass in the 
context explicitly is probably better regardless.  As to backward 
compatibility, we could maintain a shim to bridge between the old way and the 
new.


About the C-global _PyRuntime
==

Currently the global runtime state (_PyRuntimeState) is stored in a static 
global C variable, _PyRuntime.  I added it at the time I consolidated many of 
the existing C globals into a single struct.  Having a C global makes it easy 
to do the wrong thing, so it may be good to do something else.

That would mean allocating a _PyRuntimeState on the heap early in startup and 
pass that around where needed.  I expect that would not have any meaningful 
performance penalty.  It would probably also simplify some of the code we 
currently use to manage _PyRuntime correctly.

As a bonus, this would be important if we decided that 
multiple-runtimes-per-process were a desirable thing.  That's a neat idea, 
though I don't see a need currently.  So on its own it's not really a 
justification for dropping a static _PyRuntime. :)  However, I think the other 
reasons are enough.


Conclusions


This issue has a specific objective that I think is premature.  We have an 
existing pattern and we should stick with that until we decide to change to a 
new pattern.  That said, a few things should get corrected and we should 
investigate alternative patterns for the context-sensitive C-API.

As to getting rid of the _PyRuntime global variable in favor of putting it on 
the heap, I'm not opposed.  However, doing so should probably be handled in a 
separate issue.

Here are my thoughts on actionable items:

1. look for a better pattern for the context-sensitive C-API
2. clearly document which of the 3 groups each C-API function belongs to
3. add a "runtime" field to the PyInterpreterState pointing to the parent 
_PyRuntimeState
4. (maybe) add a _PyRuntimeState_GET() macro, a la PyThreadState_GET()
5. for context-sensitive C-API that uses the global 

[issue36738] Add 'array_hook' for json module

2019-04-27 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> bob.ippolito
nosy: +bob.ippolito

___
Python tracker 

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



[issue36679] duplicate method definition in Lib/test/test_genericclass.py

2019-04-27 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

OK, backported the fix to 3.7.

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



[issue35070] test_posix fails on macOS 10.14 Mojave

2019-04-27 Thread Jeffrey Kintscher


Jeffrey Kintscher  added the comment:

The test fails for me on Mohave when I build using clang 10.0.0, but passes 
when I build using gcc 8.3.0.:

ProductName:Mac OS X
ProductVersion: 10.14.3
BuildVersion:   18D109

gcc-8 (Homebrew GCC 8.3.0) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

--
nosy: +websurfer5

___
Python tracker 

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



[issue36719] regrtest --findleaks should fail if an uncollectable object is found

2019-04-27 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



[issue16425] minidom replaceChild(new_child, old_child) removes new_child even if in another document

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

Since "new_child" is inserted at least into a new place, it needs to be removed 
from its old place as well, so that part seems correct. The problem description 
does not make it clear whether or not "old_child" is handled correctly, but 
looking at the code (and lacking a complete example that shows an error), I 
cannot see anything wrong there.

I'll close this ticket since it has been idle for years and it is unclear to me 
from the description whether it is an actual misbehaviour or a misunderstanding 
of correct behaviour.

--
nosy: +scoder
resolution:  -> works for me
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



[issue21281] DEBUGGING: Simultaneous stopping of all threads on breakpoint and switching between threads

2019-04-27 Thread daniel hahler


Change by daniel hahler :


--
nosy: +blueyed

___
Python tracker 

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2019-04-27 Thread Dieter Maurer


Dieter Maurer  added the comment:

Terry J. Reedy wrote:
> SkipTest is an exception and according to the doc it should be propagated to 
> the caller.  __unittest_skip__ is an undocumented internal name, so you 
> probably should not be using it.
>
> If this request is not rejected, we will need test code demonstrating the 
> issue *that does not use zope*.

The "skip" I am speaking about is a decorator for tests or test classes telling 
a "runner" to skip tests (likely because conditions for their success are not 
met - usually, that required packages are not installed). This "skip" 
(decorator) uses `__unittest_skip__` to tell the  the "unittest runner" (that 
is `unittest.TestCase.run`) that the test should be skipped.

The "unittest runner" is extremely rudimentary and lacks many important 
features. That is why I use the much more feature rich `zope.testrunner`. I 
could implement the `__unittest_skip__` logic there - but as you wrote - this 
should remain encapsulated inside `unittest` (that's why I wrote this issue).

I attach a test script - which likely is not convincing as the feature is 
mainly important for a sophisticated test runner, not for explicit calls of 
`TestCase.debug`.

--
Added file: https://bugs.python.org/file48287/utest.py

___
Python tracker 

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



[issue36742] urlsplit doesn't accept a NFKD hostname with a port number

2019-04-27 Thread Chihiro Ito


Change by Chihiro Ito :


--
type:  -> behavior

___
Python tracker 

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



[issue8138] wsgiref.simple_server.SimpleServer claims to be multithreaded

2019-04-27 Thread Berker Peksag


Change by Berker Peksag :


--
pull_requests: +12903

___
Python tracker 

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



[issue9643] urllib2 - Basic, Digest Proxy Auth Handlers failure will give 401 code instead of 407

2019-04-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This is still an issue and the relevant RFC part and a unittest would be as 
below. I would propose adding a new keyword argument with 401 as default value 
to ensure backwards compatibility with older versions. I can propose a PR if 
agreed and also improve test case since changing the hard coded status code 
from 401 to 407 doesn't seem to cause any failure.


https://tools.ietf.org/html/rfc7235#section-3.2

3.2.  407 Proxy Authentication Required

   The 407 (Proxy Authentication Required) status code is similar to 401
   (Unauthorized), but it indicates that the client needs to
   authenticate itself in order to use a proxy.  The proxy MUST send a
   Proxy-Authenticate header field (Section 4.3) containing a challenge
   applicable to that proxy for the target resource.  The client MAY
   repeat the request with a new or replaced Proxy-Authorization header
   field (Section 4.4).

unittest

diff --git a/Lib/test/test_urllib2_localnet.py 
b/Lib/test/test_urllib2_localnet.py
index 591b48d6d4..ab8dd32795 100644
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -357,9 +357,9 @@ class ProxyAuthTests(unittest.TestCase):
 self.proxy_digest_handler.add_password(self.REALM, self.URL,
self.USER, self.PASSWD+"bad")
 self.digest_auth_handler.set_qop("auth")
-self.assertRaises(urllib.error.HTTPError,
-  self.opener.open,
-  self.URL)
+with self.assertRaises(urllib.error.HTTPError) as cm:
+self.opener.open(self.URL)
+self.assertEqual(cm.exception.code, 407)

 def test_proxy_with_no_password_raises_httperror(self):
 self.digest_auth_handler.set_qop("auth")

$ ./python.exe -m unittest -v 
test.test_urllib2_localnet.ProxyAuthTests.test_proxy_with_bad_password_raises_httperror
test_proxy_with_bad_password_raises_httperror 
(test.test_urllib2_localnet.ProxyAuthTests) ... FAIL

==
FAIL: test_proxy_with_bad_password_raises_httperror 
(test.test_urllib2_localnet.ProxyAuthTests)
--
Traceback (most recent call last):
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_urllib2_localnet.py",
 line 362, in test_proxy_with_bad_password_raises_httperror
self.assertEqual(cm.exception.code, 407)
AssertionError: 401 != 407

--
Ran 1 test in 0.160s

FAILED (failures=1)

--
nosy: +xtreak
versions: +Python 3.8 -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



[issue36735] minimize disk size of cross-compiled python3.6

2019-04-27 Thread Stefan Behnel


Change by Stefan Behnel :


--
nosy:  -scoder

___
Python tracker 

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



[issue13611] Integrate ElementC14N module into xml.etree package

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

It took me a couple of minutes longer to submit it, but it's there now. :)

I'm aware that there is a lot of new code involved, covering really three new 
features, which makes reviewing it a non-trivial task. I personally think it's 
ready to go into the last alpha release on Monday to receive some initial 
visibility, but I would like to have at least a little feedback before that. 
Even just a general opinion whether you support pushing this into 3.8 or not. 
Postponing it to the first beta would be ok, if you need more time to form an 
opinion, but having it in an alpha would improve the chance of getting user 
feedback.

--

___
Python tracker 

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



[issue21281] DEBUGGING: Simultaneous stopping of all threads on breakpoint and switching between threads

2019-04-27 Thread daniel hahler


daniel hahler  added the comment:

This is a good idea.

I am currently leaning towards using a threading.Lock around `Pdb.interaction`, 
or `pdb.set_trace` with pdb++.

This would at least mitigate the issue where `pdb.set_trace` is used in some 
code that gets executed again, and two pdb instances would use the same input, 
e.g. when debugging web applications.

See also https://bugs.python.org/issue23163 for/about improving docs in this 
regard.

--

___
Python tracker 

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



[issue36730] Change outdated references to macOS

2019-04-27 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I believe that this duplicates comments on other Mac issues.  The download web 
pages are not part of the CPython repository covered by this tracker.  I will 
let Ned comment further.

--
components: +macOS
nosy: +ned.deily, ronaldoussoren, terry.reedy -docs@python

___
Python tracker 

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



[issue36739] "4.6. Defining Functions" should mention nonlocal

2019-04-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the suggestion.  Would you like to submit a PR?

--
keywords: +easy
nosy: +rhettinger
stage:  -> needs patch

___
Python tracker 

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



[issue11001] Various obvious errors in cookies documentation

2019-04-27 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue11871] test_default_timeout() of test_threading.BarrierTests failure: BrokenBarrierError

2019-04-27 Thread David Bolen


David Bolen  added the comment:

I should mention that a high level of test parallelism on the part of my worker 
might have be a contributing factor in this most recent case.

The worker was recently upgraded to a faster 4-core VM, but with limited I/O.  
In a test run the test processes invariably end up stuck on I/O heavy tests, 
idling the CPUs.

So I've been running the tests under -j8, as I found it the most effective 
combination of supporting tests stuck on I/O while keeping the CPUs busy, but 
it does mean that in some cases there's a lot pending on the CPUs, and 
depending on the exact test ordering in a run presumably some more sensitive 
tests could be impacted.

I have in fact seen an increase in random tests generating warnings (fail, then 
pass) than the worker had previously.  I suspect the benefits of the extra 
parallelism on total test time (-j8 is about 20% faster than -j4) probably 
isn't valuable enough and will most likely be reducing it a bit.

--
nosy: +db3l

___
Python tracker 

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



[issue1047397] cgitb failures

2019-04-27 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue17274] distutils silently omits relative symlinks

2019-04-27 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue9643] urllib2 - Basic, Digest Proxy Auth Handlers failure will give 401 code instead of 407

2019-04-27 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue22029] argparse - CSS white-space: like control for individual text blocks

2019-04-27 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue9521] xml.etree.ElementTree skips processing instructions when parsing

2019-04-27 Thread Stefan Behnel


Stefan Behnel  added the comment:

Comment/PI parsing in general is implemented in issue 36673. Note that there is 
currently no way to represent comments and PIs in the tree when they appear 
outside of the root element, which I think is what this ticket is about. After 
issue 36673 is resolved, however, they can at least be picked up from the 
parser target or from iterparse() and XMLPullParser().

--
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue22640] Add silent mode for py_compile

2019-04-27 Thread Berker Peksag


Change by Berker Peksag :


--
nosy: +brett.cannon

___
Python tracker 

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



  1   2   >