[issue34505] urllib2 fails for proxy credentials that contains a '/' character

2018-08-25 Thread Balibax


New submission from Balibax :

How can solve thishttps://www.pinterest.com/CoreTricks/;>?

--
components: Build
messages: 324111
nosy: Balibax5445
priority: normal
severity: normal
status: open
title: urllib2 fails for proxy credentials that contains a '/' character
type: crash

___
Python tracker 

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



[issue34443] enum repr should use __qualname__

2018-08-25 Thread Michał Radwański

Michał Radwański  added the comment:

Serhiy, would it be ok to put '__module__' + '.' + __qualname__ here?

--
nosy: +enedil

___
Python tracker 

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



[issue34504] PySequence_Check: argument is dereferenced and then checked for NULL

2018-08-25 Thread miss-islington


miss-islington  added the comment:


New changeset d60bdf239e322316c8b5e37679cb8e789028aae2 by Miss Islington (bot) 
in branch '3.6':
closes bpo-34504: Remove the useless NULL check in PySequence_Check(). (GH-8935)
https://github.com/python/cpython/commit/d60bdf239e322316c8b5e37679cb8e789028aae2


--

___
Python tracker 

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



[issue34504] PySequence_Check: argument is dereferenced and then checked for NULL

2018-08-25 Thread miss-islington


miss-islington  added the comment:


New changeset d6725fcdd54cb3c72201eaa8841dd72d84f5f71d by Miss Islington (bot) 
in branch '3.7':
closes bpo-34504: Remove the useless NULL check in PySequence_Check(). (GH-8935)
https://github.com/python/cpython/commit/d6725fcdd54cb3c72201eaa8841dd72d84f5f71d


--
nosy: +miss-islington

___
Python tracker 

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



[issue34504] PySequence_Check: argument is dereferenced and then checked for NULL

2018-08-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8409

___
Python tracker 

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



[issue34504] PySequence_Check: argument is dereferenced and then checked for NULL

2018-08-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8408

___
Python tracker 

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



[issue34504] PySequence_Check: argument is dereferenced and then checked for NULL

2018-08-25 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset b57b4ac042b977e0b42a2f5ddb30ca7edffacfa9 by Benjamin Peterson 
(Alexey Izbyshev) in branch 'master':
closes bpo-34504: Remove the useless NULL check in PySequence_Check(). (GH-8935)
https://github.com/python/cpython/commit/b57b4ac042b977e0b42a2f5ddb30ca7edffacfa9


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



[issue34306] minidom: wrong processing of xmlns attributes

2018-08-25 Thread Victor Porton


Victor Porton  added the comment:

My bug report was wrong:

https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html
In the DOM, all namespace declaration attributes are by definition bound to the 
namespace URI: "http://www.w3.org/2000/xmlns/;. These are the attributes whose 
namespace prefix or qualified name is "xmlns" as introduced in [XML Namespaces 
1.1].

--
resolution:  -> not a bug
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



[issue34483] eval() raises NameError: name '...' is not defined

2018-08-25 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'll close this. I'm still reviewing the docs on it, and I might open a 
documentation issue once I understand it better.

--
resolution:  -> not a bug
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



[issue34483] eval() raises NameError: name '...' is not defined

2018-08-25 Thread Alex


Alex  added the comment:

Eric, thank you for the clarification. Do you want me to close the ticket?

--

___
Python tracker 

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



[issue34334] QueueHandler logs exc_info twice

2018-08-25 Thread Vinay Sajip


Vinay Sajip  added the comment:

Possibly a test needs to be added for this, as it appears to be a regression 
that went unnoticed.

--

___
Python tracker 

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



[issue34334] QueueHandler logs exc_info twice

2018-08-25 Thread Vinay Sajip


Vinay Sajip  added the comment:

> Patching QueueHandler.prepare() to set exc_text to None seems to fix this.

I'm not sure that's the right fix. The change appears to have come from this 
commit:

https://github.com/python/cpython/commit/adfe3440f65dfd6cf4463db6cd02cdc78e77ce17

Specifically, the prepare() method.

--

___
Python tracker 

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



[issue34504] PySequence_Check: argument is dereferenced and then checked for NULL

2018-08-25 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue34504] PySequence_Check: argument is dereferenced and then checked for NULL

2018-08-25 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

The argument of PySequence_Check() is dereferenced at 
https://github.com/python/cpython/blob/5f79b50763d687aeeed8edcb4efcc7ac9f8fa186/Objects/abstract.c#L1511
 and then checked for NULL.

Reported by Svace static analyzer.

Since other PySomething_Check() functions seem to expect a non-NULL argument, I 
suggest to remove the NULL check instead of moving it.

--
components: Interpreter Core
messages: 324101
nosy: benjamin.peterson, berker.peksag, izbyshev, serhiy.storchaka
priority: normal
severity: normal
status: open
title: PySequence_Check: argument is dereferenced and then checked for NULL
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue34403] test_utf8_mode.test_cmd_line() fails on HP-UX due to false assumptions

2018-08-25 Thread Michael Osipov


Michael Osipov <1983-01...@gmx.net> added the comment:

I think you are absoltely right.

> In any case, it seems to be broken for any system that does not have UTF-8 as 
> default.

You likely mean ASCII. Python assumes that LANG=C is ASCII which is not the 
case for AIX and HP-UX.

Your patch looks reasonable, I will try this on Monday. The problem is that 
there is no roman8 codec in Python. Maybe ISO-8859-1 will do it for the test, 
but I am still eager to add one.

> I mention this because it seems neither roman8 nor roman9 have 'official' iso 
> names or alias (correct me if I am wrong).

There are no ISO names because this is not an ISO encoding. This is an HP 
invention aka hp-roman8 (roman8, ibm-1051, r8, Cp1051).

Edit: there is roman8 support: 
https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Lib/encodings/hp_roman8.py
 as well as aliases.

There are a few aliases missing: cp1051, ibm1051 and hp-roman8. This needs an 
additonal PR.

--

___
Python tracker 

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



[issue34503] Reference leak in PyErr_SetObject()

2018-08-25 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue34494] simple "sequence" class ignoring __len__

2018-08-25 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue34503] Reference leak in PyErr_SetObject()

2018-08-25 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

'exc_value' reference is leaked at 
https://github.com/python/cpython/blob/5f79b50763d687aeeed8edcb4efcc7ac9f8fa186/Python/errors.c#L113

--
components: Interpreter Core
messages: 324099
nosy: benjamin.peterson, berker.peksag, izbyshev, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Reference leak in PyErr_SetObject()
type: resource usage
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue14465] xml.etree.ElementTree: add feature to prettify XML output

2018-08-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

A few more thoughts for consideration:

* We already have a toprettyxml() tool in the minidom package.

* Since whitespace is significant in XML, prettifying changes the content and 
meaning, so it doesn't round-trip and should only be used for debugging 
purposes.

* Usually, I recommend using XML viewers such as the one built into the Chrome 
browser.  That provides indentation without changing meaning. It also lets you 
run searches and conveniently supports folding and unfolding elements.   I 
would rather someone use a viewer rather than something like toprettyxml().

--
nosy: +rhettinger

___
Python tracker 

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



[issue34347] AIX: test_utf8_mode.test_cmd_line fails

2018-08-25 Thread Michael Osipov


Michael Osipov <1983-01...@gmx.net> added the comment:

This is a very thorough analysis. Kudos to that.

--
nosy: +michael-o

___
Python tracker 

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



[issue23325] Turn SIG_DFL and SIG_IGN into functions

2018-08-25 Thread Xiang Zhang


Xiang Zhang  added the comment:

I miss that. So this change seems to be user transparent and make more sense 
then.

--
nosy: +vstinner

___
Python tracker 

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



[issue11190] test_locale error on AIX

2018-08-25 Thread Michael Felt


Michael Felt  added the comment:

FYI - this test passes on Python3.X and Python3.7 bots, still fails on Python2.7

In short "fixed" for Python3.

--
components: +Tests

___
Python tracker 

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



[issue14465] xml.etree.ElementTree: add feature to prettify XML output

2018-08-25 Thread Matej Cepl


Change by Matej Cepl :


--
pull_requests: +8405

___
Python tracker 

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



[issue34501] PyType_FromSpecWithBases: spec->name is dereferenced before checking for NULL

2018-08-25 Thread miss-islington


miss-islington  added the comment:


New changeset 323a91bb3a2b5639637efc517fe3f30d3bc288e2 by Miss Islington (bot) 
in branch '3.6':
closes bpo-34501: PyType_FromSpecWithBases: Check spec->name before 
dereferencing it. (GH-8930)
https://github.com/python/cpython/commit/323a91bb3a2b5639637efc517fe3f30d3bc288e2


--

___
Python tracker 

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



[issue34501] PyType_FromSpecWithBases: spec->name is dereferenced before checking for NULL

2018-08-25 Thread miss-islington


miss-islington  added the comment:


New changeset 15dadacabf6a1c62e9920b6a42ff8936ea1830f8 by Miss Islington (bot) 
in branch '3.7':
closes bpo-34501: PyType_FromSpecWithBases: Check spec->name before 
dereferencing it. (GH-8930)
https://github.com/python/cpython/commit/15dadacabf6a1c62e9920b6a42ff8936ea1830f8


--
nosy: +miss-islington

___
Python tracker 

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



[issue34501] PyType_FromSpecWithBases: spec->name is dereferenced before checking for NULL

2018-08-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8404

___
Python tracker 

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



[issue34501] PyType_FromSpecWithBases: spec->name is dereferenced before checking for NULL

2018-08-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8403

___
Python tracker 

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



[issue34501] PyType_FromSpecWithBases: spec->name is dereferenced before checking for NULL

2018-08-25 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 5f79b50763d687aeeed8edcb4efcc7ac9f8fa186 by Benjamin Peterson 
(Alexey Izbyshev) in branch 'master':
closes bpo-34501: PyType_FromSpecWithBases: Check spec->name before 
dereferencing it. (GH-8930)
https://github.com/python/cpython/commit/5f79b50763d687aeeed8edcb4efcc7ac9f8fa186


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



[issue34501] PyType_FromSpecWithBases: spec->name is dereferenced before checking for NULL

2018-08-25 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

@enedil It seems that all later check either set a message or simply propagate 
the error set by a called function. Did you mean any specific later check?

--

___
Python tracker 

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



[issue34501] PyType_FromSpecWithBases: spec->name is dereferenced before checking for NULL

2018-08-25 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue34501] PyType_FromSpecWithBases: spec->name is dereferenced before checking for NULL

2018-08-25 Thread Michał Radwański

Michał Radwański  added the comment:

But if the error message is set, then for consistency, it should be also the 
case that the later checks set some kind of error message.

--
nosy: +enedil

___
Python tracker 

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



[issue34502] Docs of sys.exit() mention utf8_mode for an unclear reason

2018-08-25 Thread miss-islington


miss-islington  added the comment:


New changeset 42a1ca65d00ba59fe63cc65df0ff297a885e61b8 by Miss Islington (bot) 
in branch '3.7':
closes bpo-34502: Remove a note about utf8_mode from sys.exit() docs. (GH-8928)
https://github.com/python/cpython/commit/42a1ca65d00ba59fe63cc65df0ff297a885e61b8


--
nosy: +miss-islington

___
Python tracker 

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



[issue34501] PyType_FromSpecWithBases: spec->name is dereferenced before checking for NULL

2018-08-25 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

Your suggested fix seems fine to me.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue34502] Docs of sys.exit() mention utf8_mode for an unclear reason

2018-08-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8401

___
Python tracker 

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



[issue34502] Docs of sys.exit() mention utf8_mode for an unclear reason

2018-08-25 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 44838be9f79870ff3c9e04b7398a1dc3d56d53ed by Benjamin Peterson 
(Alexey Izbyshev) in branch 'master':
closes bpo-34502: Remove a note about utf8_mode from sys.exit() docs. (GH-8928)
https://github.com/python/cpython/commit/44838be9f79870ff3c9e04b7398a1dc3d56d53ed


--
nosy: +benjamin.peterson
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



[issue34502] Docs of sys.exit() mention utf8_mode for an unclear reason

2018-08-25 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue34502] Docs of sys.exit() mention utf8_mode for an unclear reason

2018-08-25 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

Docs for sys.exit() contain the following note added in 
https://github.com/python/cpython/blame/1871a4a35123b278443b960255cb14314ce196f6/Doc/library/sys.rst#L336

Changed in version 3.7: Added utf8_mode attribute for the new -X utf8 flag.

Does it belong to the adjacent docs for sys.flags (though they mention 
utf8_mode too)?

--
assignee: docs@python
components: Documentation
messages: 324086
nosy: docs@python, izbyshev, vstinner
priority: normal
severity: normal
status: open
title: Docs of sys.exit() mention utf8_mode for an unclear reason
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue33569] dataclasses InitVar does not maintain any type info

2018-08-25 Thread Augusto Hack


Change by Augusto Hack :


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

___
Python tracker 

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



[issue23325] Turn SIG_DFL and SIG_IGN into functions

2018-08-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Numerical values of signal numbers are standardized. signal.signal(15, handler) 
is valid. SIGTERM is just a handy name for the constant 15.

But SIG_DFL and SIG_IGN are not integers in C (they are special pointers), and 
it is not declared anywhere that they should be integers in Python. The code 
that converts them to Python integer is implementation depending 
(PyLong_FromVoidPtr). Handcrafted SIG_DFL and SIG_IGN are broken by design, 
because the signal module uses identity comparison for SIG_DFL and SIG_IGN.

--

___
Python tracker 

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



[issue34403] test_utf8_mode.test_cmd_line() fails on HP-UX due to false assumptions

2018-08-25 Thread Michael Felt


Michael Felt  added the comment:

As the AIX complaint is (was once the PR merges):
AssertionError: "['h\\xc3\\xa9\\xe2\\x82\\xac']" != 
"['h\\udcc3\\udca9\\udce2\\udc82\\udcac']"
- ['h\xc3\xa9\xe2\x82\xac']
+ ['h\udcc3\udca9\udce2\udc82\udcac']

And the HP-UX complaint is:
  File "/var/osipovmi/cpython/Lib/test/test_utf8_mode.py", line 223, in check
self.assertEqual(args, ascii(expected), out)
AssertionError: "['h\\xc3\\xa9\\xe2\\x82\\xac']" != 
"['h\\udcc3\\udca9\\udce2\\udc82\\udcac']"
- ['h\xc3\xa9\xe2\x82\xac']
+ ['h\udcc3\udca9\udce2\udc82\udcac']

Maybe a change such as:

--- a/Lib/test/test_utf8_mode.py
+++ b/Lib/test/test_utf8_mode.py
@@ -219,6 +219,8 @@ class UTF8ModeTests(unittest.TestCase):
 check('utf8', [arg_utf8])
 if sys.platform == 'darwin' or support.is_android:
 c_arg = arg_utf8
+elif (platform.system == "AIX") or
+  sys.platform.startswith("hp-ux"):
+c_arg = arg.decode('iso-8859-1')
 else:
 c_arg = arg_ascii
 check('utf8=0', [c_arg], LC_ALL='C')

I mention this because it seems neither roman8 nor roman9 have 'official' iso 
names or alias (correct me if I am wrong).

--

___
Python tracker 

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



[issue32968] Fraction modulo infinity should behave consistently with other numbers

2018-08-25 Thread Mark Dickinson


Change by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue34494] simple "sequence" class ignoring __len__

2018-08-25 Thread Eric Wieser


Eric Wieser  added the comment:

What I think I find surprising is that I'd expect the sequence protocol to be 
defined by `__getitem__` and `__len__`, and for `__iter__` to be inferred as:

def __iter__(self):
for i in range(len(self)):
yield self[i]

But in reality it seems it is inferred only from `__getitem__`, as:

def __iter__(self):
i = 0
while True:
try:
yield self[i]
except IndexError:
return
i += 1

--

___
Python tracker 

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



[issue34498] Python 3.7 breaks on singledispatch_function.register(pseudo_type), which Python 3.6 accepted

2018-08-25 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

This is why we have 4 months of betas :-)

On one hand making objects in `typing` module not classes was intentional, but 
on another hand this use case looks totally fine.

I would say we could update the check in `functools` to accept more things. I 
am however not sure what to allow here in addition to proper classes, maybe 
just anything that overrides `__subclasscheck__` and/or `__instancecheck__`? I 
could imagine there might be some other objects that implement custom instance 
and class checks beyond `typing` that are rejected by current checks in 
`functools`.

As a temporary workaround you can use `collections.abc.Sequence`, this type is 
aliased by `typing.Sequence`, in fact all instance checks etc. are relayed to 
the former.

--
nosy: +rhettinger

___
Python tracker 

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



[issue34498] Python 3.7 breaks on singledispatch_function.register(pseudo_type), which Python 3.6 accepted

2018-08-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

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



[issue34494] simple "sequence" class ignoring __len__

2018-08-25 Thread Eric Wieser


Change by Eric Wieser :


--
nosy: +Eric.Wieser

___
Python tracker 

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



[issue32968] Fraction modulo infinity should behave consistently with other numbers

2018-08-25 Thread Mark Dickinson


Change by Mark Dickinson :


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



[issue34498] Python 3.7 breaks on singledispatch_function.register(pseudo_type), which Python 3.6 accepted

2018-08-25 Thread Michał Radwański

Michał Radwański  added the comment:

The change is not only in the added `isinstance` check:

~ $ python3.6 -q
>>> import typing
>>> isinstance(typing.Sequence, type)
True
>>>
~ $ python3.7 -q
>>> import typing
>>> isinstance(typing.Sequence, type)
False
>>>

--
nosy: +enedil

___
Python tracker 

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



[issue32968] Fraction modulo infinity should behave consistently with other numbers

2018-08-25 Thread Mark Dickinson


Mark Dickinson  added the comment:

Sorry that I've taken so long to get back to this. I've just updated the PR, 
and I think it's ready to go. Looks like it does need you to update your GitHub 
username here in the "Your Details" section of the bugtracker, though; sorry 
about that.

> If we can't depend on that result, do you have any suggestions?

Yes: check that 1.0 // 1/10 equals 1.0 // 0.1, and similarly for %. I've made 
that change in the PR.

--

___
Python tracker 

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



[issue34492] Python/coreconfig.c: Fix _Py_wstrlist_copy()

2018-08-25 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 388bd4bd7622f6781260ed388f7c76b673adb0e1 by Victor Stinner 
(Alexey Izbyshev) in branch '3.7':
[3.7] bpo-34492: Modules/main.c: Fix copy_wstrlist() (GH-8910) (GH-8922)
https://github.com/python/cpython/commit/388bd4bd7622f6781260ed388f7c76b673adb0e1


--

___
Python tracker 

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



[issue34492] Python/coreconfig.c: Fix _Py_wstrlist_copy()

2018-08-25 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Alexey Izbyshev for the bug report and the fix for 3.7 and master 
branches!

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



[issue32973] Importing the same extension module under multiple names breaks non-reinitialisable extension modules

2018-08-25 Thread Stefan Behnel


Stefan Behnel  added the comment:

FYI, I've updated Cython's module import checks to include an interpreter 
check. This (multi-file) test shows the new behaviour, which is to raise an 
ImportError on module creation when it detects a different interpreter than 
during the initial import:

https://github.com/cython/cython/blob/master/tests/run/reimport_from_subinterpreter.srctree

The checks are implemented here (and called a bit further down in the module 
create function):
https://github.com/cython/cython/blob/4ce754271ff4cfbd8df2b278e812154fb1b02319/Cython/Utility/ModuleSetupCode.c#L909-L932

I also added a test that should match the problem discussed here, which makes 
what I described appear as a viable solution (or work-around):

https://github.com/cython/cython/blob/master/tests/run/reimport_from_package.srctree

--

___
Python tracker 

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



[issue34453] ipaddress module accepts some strange IPv6 addresses that it shouldn't

2018-08-25 Thread Michał Radwański

Michał Radwański  added the comment:

The point is that the specification is not complete and thus left for the 
implementations to decide. Python's version hits the sweet spot between 
inclusive and correct - as long as a version is unambiguous, it is accepted.

--

___
Python tracker 

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



[issue23325] Turn SIG_DFL and SIG_IGN into functions

2018-08-25 Thread Xiang Zhang


Xiang Zhang  added the comment:

I'm afraid this could break old codes so not sure it's worth or not. I've seen 
code like `SIGTERM = 15; signal.signal(SIGTERM, handler)`. I won't be surprised 
to see a handcraft SIG_DFL/IGN.

--
nosy: +xiang.zhang
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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-25 Thread Zachary Ware


Zachary Ware  added the comment:

No, there isn't.  However, https://github.com/python/buildmaster-config/pull/43 
should help; I'll try to get that deployed later today.

--

___
Python tracker 

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



[issue34501] PyType_FromSpecWithBases: spec->name is dereferenced before checking for NULL

2018-08-25 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

In the following snippet from PyType_FromSpecWithBases() in 
Objects/typeobject.c, spec->name is dereferenced by strrchr() but then is 
checked for NULL:

/* Set the type name and qualname */
s = strrchr(spec->name, '.');
if (s == NULL)
s = (char*)spec->name;
else
s++;

[snip]

type->tp_name = spec->name;
if (!type->tp_name)
goto fail;

This was reported by Svace static analyzer.

If I were to check spec->name first, what error should I report to the caller? 
Is something like the following OK?

if (spec->name == NULL) {
PyErr_SetString(PyExc_SystemError,
   "Type spec does not define the name field.");
goto fail;
}

--
components: Interpreter Core
messages: 324073
nosy: berker.peksag, izbyshev, serhiy.storchaka
priority: normal
severity: normal
status: open
title: PyType_FromSpecWithBases: spec->name is dereferenced before checking for 
NULL
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue34500] Fix ResourceWarning in difflib.py

2018-08-25 Thread Mickaël Schoentgen

Mickaël Schoentgen  added the comment:

This is a little patch to mostly keep aligned with 
https://github.com/google/python-fire/pull/135.

--

___
Python tracker 

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



[issue34500] Fix ResourceWarning in difflib.py

2018-08-25 Thread Mickaël Schoentgen

Change by Mickaël Schoentgen :


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

___
Python tracker 

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



[issue34500] Fix ResourceWarning in difflib.py

2018-08-25 Thread Mickaël Schoentgen

New submission from Mickaël Schoentgen :

Fix 2 unclosed files in the documentation and the difflib.py script:

diff.py:77: ResourceWarning: unclosed file <_io.TextIOWrapper 
name='/tmp/tmpnby8pemn' mode='U' encoding='UTF-8'>
fromlines = open(fromfile, 'U').readlines()
diff.py:78: ResourceWarning: unclosed file <_io.TextIOWrapper 
name='/tmp/tmpnby8pemm' mode='U' encoding='UTF-8'>
self.tolines = open(tofile, 'U').readlines()

--
assignee: docs@python
components: Demos and Tools, Documentation
messages: 324071
nosy: David Bieber, Tiger-222, docs@python
priority: normal
severity: normal
status: open
title: Fix ResourceWarning in difflib.py
versions: Python 2.7

___
Python tracker 

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



[issue34403] test_utf8_mode.test_cmd_line() fails on HP-UX due to false assumptions

2018-08-25 Thread Michael Felt


Michael Felt  added the comment:

It might be as simple as what I saw for AIX:

diff --git a/Lib/test/test_utf8_mode.py b/Lib/test/test_utf8_mode.py
index 26e2e13ec5..3e918fd54c 100644
--- a/Lib/test/test_utf8_mode.py
+++ b/Lib/test/test_utf8_mode.py
@@ -219,6 +219,8 @@ class UTF8ModeTests(unittest.TestCase):
 check('utf8', [arg_utf8])
 if sys.platform == 'darwin' or support.is_android:
 c_arg = arg_utf8
+elif sys.platform.startswith("aix"):
+c_arg = arg.decode('iso-8859-1')
 else:
 c_arg = arg_ascii
 check('utf8=0', [c_arg], LC_ALL='C')

so, adding below might be all that is needed:
+elif sys.platform == "hpux":
+c_arg = arg.decode('roman8')

--

___
Python tracker 

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



[issue32973] Importing the same extension module under multiple names breaks non-reinitialisable extension modules

2018-08-25 Thread Stefan Behnel

Stefan Behnel  added the comment:

Well, first of all, it's better than a crash. :)

Secondly, I'm sure NumPy doesn't currently support subinterpreters, just like 
most other extension modules. If I'm not mistaken, an interpreter switch can be 
detected through the interpreter state pointer [1] in the thread state, and 
extension modules that lack subinterpreter support can consider a change an 
error for them. since then something is trying to re-import the module into a 
different interpreter. That's not entirely safe since addresses can be reused, 
which I guess was the reason for adding an ID [2] in Py3.7, but that's only 
available in Py3.7+, not in Py3.5. So, the interpreter address is probably as 
good as it gets for Py<3.7.

[1] https://docs.python.org/3/c-api/init.html#c.PyThreadState
[2] https://docs.python.org/3/c-api/init.html#c.PyInterpreterState_GetID

Note: I'm not trying to keep anyone from implementing subinterpreter support 
here – just showing a way to keep things working and improving gradually as 
long as there is no full support for PEP 489, extension module reloading and 
subinterpreters, so that users don't have to go all the way in one step.

--

___
Python tracker 

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



[issue32973] Importing the same extension module under multiple names breaks non-reinitialisable extension modules

2018-08-25 Thread Petr Viktorin


Petr Viktorin  added the comment:

That's quite problematic, since then you're sharing a mutable object across 
interpreters.
The user can store any attribute on module objects, including e.g. Python 
functions that reference their original interpreter's global state, but become 
callable in other interpreters.

--

___
Python tracker 

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



[issue34347] AIX: test_utf8_mode.test_cmd_line fails

2018-08-25 Thread Michael Felt


Michael Felt  added the comment:

Solution much simpler than I thought:

not arg.decode('ascii', 'surrogateescape'), but arg.decode('iso-8859-1')

--

___
Python tracker 

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



[issue34347] AIX: test_utf8_mode.test_cmd_line fails

2018-08-25 Thread Michael Felt


Change by Michael Felt :


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

___
Python tracker 

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



[issue32973] Importing the same extension module under multiple names breaks non-reinitialisable extension modules

2018-08-25 Thread Stefan Behnel


Stefan Behnel  added the comment:

I think the best work-around for now is to implement a bit of PEP 489, 
including a module create function that always returns the same static module 
reference instead of creating a new one after the first call, and a module exec 
function that simply returns if the module has already been initialised. 
Keeping a global pointer to the module instance around should work. This is 
what the current Cython master branch does (also to make use of some of the 
nice features that PEP 489 brings).

--

___
Python tracker 

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



[issue34492] Python/coreconfig.c: Fix _Py_wstrlist_copy()

2018-08-25 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


--
title: Python/coreconfig.c: Missing NULL check in _Py_wstrlist_copy() -> 
Python/coreconfig.c: Fix _Py_wstrlist_copy()

___
Python tracker 

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



[issue34492] Python/coreconfig.c: Missing NULL check in _Py_wstrlist_copy()

2018-08-25 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

@zach.ware Is there a way to clean the workspace of these buildbots 
programmatically/from the UI? I can do it myself if you tell me how it must be 
done.

--
nosy: +zach.ware

___
Python tracker 

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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Seems this is a temporary issue. Tests are failed due to trace.cover files left 
from previous runs. Recreating the working space from zero should fix the 
issue, but I don't know how to do this on all buildbots.

--

___
Python tracker 

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



[issue34492] Python/coreconfig.c: Missing NULL check in _Py_wstrlist_copy()

2018-08-25 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


--
pull_requests: +8395

___
Python tracker 

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



[issue34499] Extend registering of single-dispatch functions to parametrized generic pseudo-types

2018-08-25 Thread Dutcho


New submission from Dutcho :

While issue #34498 signalled a break in Python 3.7 of legal Python 3.6 code 
that registers a single-dispatch function with a 'pseudo-type' like 
typing.Sequence, both Python 3.6 and Python 3.7 don't work with a 'parametrized 
pseudo-type' like typing.Sequence[int].
However, to fully benefit from Python 3.7's use of annotations for registering 
single-dispatch functions, these 'parametrized pseudo-types' should also be 
acceptable.

E.g. in Python 3.6:
$ py -3.6
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from functools import singledispatch
>>> from typing import Iterable, Sequence, T
>>>
>>> @singledispatch
... def last(iterable: Iterable[T]) -> T:
... for last in iterable:
... pass
... return 'slow', last
...
>>> @last.register(Sequence)
... def _(sequence: Sequence[T]) -> T:
... return 'fast', sequence[-1]
...
>>> print(*last(iter([1, 2, 3])))
slow 3
>>> print(*last([1, 2, 3]))
fast 3

Note in Python 3.6 no match results if the 'parametrized pseudo-type' 
Sequence[T] is specified as argument to last.register() as isinstance(..., 
Sequence[T]) fails.

To fully benefit from Python 3.7's use of annotations for single-dispatch 
functions, it should
(1) accept 
>>> @last.register
... def _(sequence: Sequence[T]) -> T:
... return 'fast', sequence[-1]
and (2) remove the T parameter of Sequence for matching when dispatching. I 
recognize this could potentially create a clash between e.g. Sequence[int] and 
Sequence[str]

--
components: Library (Lib)
messages: 324063
nosy: Dutcho
priority: normal
severity: normal
status: open
title: Extend registering of single-dispatch functions to parametrized generic 
pseudo-types
type: enhancement
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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Several buildbots are failing due to commit 
c406d5cd74002964a64c3eb7d9e2445a7fd3a03f:

https://buildbot.python.org/all/#/builders/40/builds/709
https://buildbot.python.org/all/#/builders/21/builds/1459
https://buildbot.python.org/all/#/builders/13/builds/1476
https://buildbot.python.org/all/#/builders/53/builds/1470
https://buildbot.python.org/all/#/builders/133/builds/477
https://buildbot.python.org/all/#/builders/145/builds/327
https://buildbot.python.org/all/#/builders/85/builds/1302
https://buildbot.python.org/all/#/builders/141/builds/358
https://buildbot.python.org/all/#/builders/126/builds/564
https://buildbot.python.org/all/#/builders/147/builds/213
https://buildbot.python.org/all/#/builders/119/builds/611
https://buildbot.python.org/all/#/builders/116/builds/590
https://buildbot.python.org/all/#/builders/143/builds/233
https://buildbot.python.org/all/#/builders/93/builds/1072
https://buildbot.python.org/all/#/builders/3/builds/1257
https://buildbot.python.org/all/#/builders/32/builds/1331
https://buildbot.python.org/all/#/builders/115/builds/520
https://buildbot.python.org/all/#/builders/128/builds/571
https://buildbot.python.org/all/#/builders/99/builds/1335
https://buildbot.python.org/all/#/builders/121/builds/497
https://buildbot.python.org/all/#/builders/113/builds/540
https://buildbot.python.org/all/#/builders/154/builds/166

Sample error:

==
FAIL: test_cover_files_written_no_highlight 
(test.test_trace.TestCoverageCommandLineOutput)
--
Traceback (most recent call last):
  File 
"/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_trace.py",
 line 393, in test_cover_files_written_no_highlight
self.assertFalse(os.path.exists(tracecoverpath))
AssertionError: True is not false
--
Ran 21 tests in 17.796s
FAILED (failures=1)
test test_trace failed
1 test failed again:
test_trace

--
nosy: +pablogsal
status: closed -> open

___
Python tracker 

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



[issue34497] Remove needless set operator restriction

2018-08-25 Thread Xiang Zhang


Change by Xiang Zhang :


--
nosy: +rhettinger

___
Python tracker 

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



[issue34498] Python 3.7 breaks on singledispatch_function.register(pseudo_type), which Python 3.6 accepted

2018-08-25 Thread Dutcho


New submission from Dutcho :

In Python 3.6, the argument to the register() method of a single-dispatch 
function (i.e. a function decorated by @functools.singledispatch) can be a 
'type-like' class (pseudo-type?) from e.g. the typing module that supports 
isinstance().

The below demonstrates it works in Python 3.6:

$ py -3.6
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from functools import singledispatch
>>> from typing import Sequence
>>> isinstance([1,2,3], Sequence) # 'pseudo-type' okay with isinstance
True
>>> @singledispatch
... def f(arg):
... print('unqualified', arg)
...
>>> @f.register(Sequence) # 'pseudo-type' okay with register
... def _(arg):
... print('sequence', *arg)
...
>>> f(1)
unqualified 1
>>> f([1,2,3])
sequence 1 2 3

This code breaks in Python 3.7:

$ py
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from functools import singledispatch
>>> from typing import Sequence
>>> isinstance([1,2,3], Sequence) # 'pseudo-type' okay with isinstance
True
>>> @singledispatch
... def f(arg):
... print('unqualified', arg)
...
>>> @f.register(Sequence)  # 'pseudo-type' NOT okay with register
... def _(arg):
... print('sequence', *arg)
...
Traceback (most recent call last):
  File "", line 1, in 
  File "D:\Program Files\Python\Python37\lib\functools.py", line 801, in 
register
f"Invalid first argument to `register()`: {cls!r}. "
TypeError: Invalid first argument to `register()`: typing.Sequence. Use either 
`@register(some_class)` or plain `@register` on an annotated function.

While agreeing a check on the register() arg IS required, the current check 
isinstance(cls, type) seems overly restrictive. This is especially true when 
considering the (welcome!) Python 3.7 use of annotations for single dispatch 
functions.

--
components: Library (Lib)
messages: 324061
nosy: Dutcho
priority: normal
severity: normal
status: open
title: Python 3.7 breaks on singledispatch_function.register(pseudo_type), 
which Python 3.6 accepted
type: crash
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



[issue34497] Remove needless set operator restriction

2018-08-25 Thread Dan Snider


Change by Dan Snider :


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

___
Python tracker 

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



[issue34497] Remove needless set operator restriction

2018-08-25 Thread Dan Snider


New submission from Dan Snider :

I only just now realized that `dict.fromkeys('abc').keys() - 'bc'` returns 
{'a'} instead of raising an error like {*'abc'} - 'bc' would, which is really 
quite handy. 

The __xor__, __and__, and __sub__ methods of dict_keys (and items, assuming no 
there are no unhashable values) work just as set.symmetric_difference, 
set.intersection, and set.difference do, respectively.

>>> a, b, c, d = [*map(dict.keys, map(dict.fromkeys, 'abcd'))]
>>> ((a | 'a') | (b & 'b') | (c ^ 'c')) - d
{'b', 'a'}
>>> a, b, c, d = [*map(dict.items, map(dict.fromkeys, 'abcd'))]
>>> ((a | 'a') | (b & 'b') | (c ^ 'c')) - d
{'c', ('a', None), 'a', ('c', None)}

However, set objects are arbitrarily restricted to taking a set object for the 
second argument on these functions. As for the first example here, there is 
even code specifically there to handle a dictionary as the second argument, but 
it is unreachable when called through the dunder version. 

{, , }
>>> {list, set} | dict.fromkeys((dict, set))
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unsupported operand type(s) for |: 'set' and 'dict'

>>> {*'abc'}.difference('cde')
{'b', 'a'}
>>> {*'abc'} - set('cde')
{'b', 'a'}
>>> {*'abc'} - 'cde'
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unsupported operand type(s) for -: 'set' and 'str'

>>> {1,2,3}.symmetric_difference(b'\x00')
{0, 1, 2, 3}
>>> {1,2,3} ^ b'\x00'
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unsupported operand type(s) for ^: 'set' and 'bytes'

The sources of set_and, set_sub, and set_xor all look like this. All they do is 
add a check that the second argument is a set and then simply call the same 
function their respective non-dunder method uses. They're so identical in fact 
that set_xor actually calls the exact same C function used in the PyMethodDef 
for set.symmetric_update:

static PyObject *
set_xor(PySetObject *so, PyObject *other)
{
if (!PyAnySet_Check(so) || !PyAnySet_Check(other))
Py_RETURN_NOTIMPLEMENTED;
return set_symmetric_difference(so, other);
}
static PyMethodDef set_methods[] = {
/* ... */
{"symmetric_difference",(PyCFunction)set_symmetric_difference, 
 METH_O, symmetric_difference_doc},
/* ... */
};

All that's needed to fix this is to remove a total of 106 characters from 
setobject.c (4 x " || !PyAnySet_Check(other)").

--
components: Interpreter Core, Library (Lib)
messages: 324060
nosy: bup
priority: normal
severity: normal
status: open
title: Remove needless set operator restriction
type: enhancement
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue34395] memory leaks in error handling in csv and pickle modules

2018-08-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you for your report and fix Sergey.

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



[issue34395] memory leaks in error handling in csv and pickle modules

2018-08-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 90555eca44a19c743d39b7fd2e05f7bc37fb5cb8 by Serhiy Storchaka 
(Sergey Fedoseev) in branch 'master':
bpo-34395: Don't free allocated memory on realloc fail in load_mark() in 
_pickle.c. (GH-8788)
https://github.com/python/cpython/commit/90555eca44a19c743d39b7fd2e05f7bc37fb5cb8


--

___
Python tracker 

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



[issue23325] Turn SIG_DFL and SIG_IGN into functions

2018-08-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +8393

___
Python tracker 

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



[issue34453] ipaddress module accepts some strange IPv6 addresses that it shouldn't

2018-08-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +ncoghlan, pmoody

___
Python tracker 

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



[issue34453] ipaddress module accepts some strange IPv6 addresses that it shouldn't

2018-08-25 Thread Prudvi RajKumar Maddala


Prudvi RajKumar Maddala  added the comment:

I think Michal is right

--

___
Python tracker 

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



[issue34494] simple "sequence" class ignoring __len__

2018-08-25 Thread Prudvi RajKumar Maddala


Prudvi RajKumar Maddala  added the comment:

I think it should hang, since we are not throwing any StopIteration exception 
to break the infinite loop

--
nosy: +prudvinit

___
Python tracker 

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



[issue34453] ipaddress module accepts some strange IPv6 addresses that it shouldn't

2018-08-25 Thread Luke Kenneth Casson Leighton


Luke Kenneth Casson Leighton  added the comment:

that's interesting, michael: it means that all of the
IPv6 validators online are wrong, like this one!
https://formvalidation.io/guide/validators/ip/

--

___
Python tracker 

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



[issue34428] tokenize

2018-08-25 Thread Luke Kenneth Casson Leighton


Luke Kenneth Casson Leighton  added the comment:

yep good call terry, not getting any response from the
autopep8 developer, and i believe it was down to a loop
where the text is being thrown line-by-line at tokenize
and it was losing critical state information.  so...
not a bug in tokenize.

--

___
Python tracker 

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



[issue34334] QueueHandler logs exc_info twice

2018-08-25 Thread Danish Prakash


Danish Prakash  added the comment:

I would like to work on this, just making sure you are not.

--
nosy: +prakashdanish

___
Python tracker 

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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-25 Thread Jörn Heissler

Jörn Heissler  added the comment:

That's what I'm doing now.
But it would be more convenient if I could pass a bytearray.

--

___
Python tracker 

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



[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-25 Thread Xiang Zhang


Xiang Zhang  added the comment:

Why not just bytes(buf[:4]) before passing?

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-25 Thread Jörn Heissler

Jörn Heissler  added the comment:

My use case is parsing binary data. For that I use a bytearray as a buffer. 
buf[:4] gets me another bytearray which I'd want to convert to an ipaddress.

I can't think of a usecase for list-of-int.

--

___
Python tracker 

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



[issue34334] QueueHandler logs exc_info twice

2018-08-25 Thread Xiang Zhang


Change by Xiang Zhang :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-25 Thread miss-islington


miss-islington  added the comment:


New changeset 80e9fedcf579537c5bc51ff3c9c18d14d9598564 by Miss Islington (bot) 
in branch '3.7':
bpo-34171: Prevent creating Lib/trace.cover when run the trace module. (GH-8841)
https://github.com/python/cpython/commit/80e9fedcf579537c5bc51ff3c9c18d14d9598564


--
nosy: +miss-islington

___
Python tracker 

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



[issue34355] SIGSEGV (Address boundary error)

2018-08-25 Thread Xiang Zhang


Xiang Zhang  added the comment:

So this is a dupliate of #34087 and we can close it?

--
nosy: +inada.naoki, xiang.zhang

___
Python tracker 

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



[issue34465] ipaddress should accept bytearray in addition to bytes

2018-08-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What is your use case?

New features can be added only in the developed version.

--
nosy: +ncoghlan, pmoody, serhiy.storchaka
versions:  -Python 3.4, Python 3.5, 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



[issue34493] Objects/genobject.c: Missing NULL check in compute_cr_origin()

2018-08-25 Thread miss-islington


miss-islington  added the comment:


New changeset 46af206ea4e9d67375559f8c584a996f70b7b7e5 by Miss Islington (bot) 
in branch '3.7':
closes bpo-34493: Objects/genobject.c: Add missing NULL check to 
compute_cr_origin() (GH-8911)
https://github.com/python/cpython/commit/46af206ea4e9d67375559f8c584a996f70b7b7e5


--
nosy: +miss-islington

___
Python tracker 

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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8392

___
Python tracker 

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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset c406d5cd74002964a64c3eb7d9e2445a7fd3a03f by Serhiy Storchaka in 
branch 'master':
bpo-34171: Prevent creating Lib/trace.cover when run the trace module. (GH-8841)
https://github.com/python/cpython/commit/c406d5cd74002964a64c3eb7d9e2445a7fd3a03f


--

___
Python tracker 

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



[issue34486] "RuntimeError: release unlocked lock" when starting a thread

2018-08-25 Thread Xiang Zhang


Change by Xiang Zhang :


--
nosy: +vstinner, xiang.zhang

___
Python tracker 

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



[issue34493] Objects/genobject.c: Missing NULL check in compute_cr_origin()

2018-08-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8391

___
Python tracker 

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



[issue34493] Objects/genobject.c: Missing NULL check in compute_cr_origin()

2018-08-25 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 8fdd331bbf7e60dd81c02c7077f44c7939e2a05d by Benjamin Peterson 
(Alexey Izbyshev) in branch 'master':
closes bpo-34493: Objects/genobject.c: Add missing NULL check to 
compute_cr_origin() (GH-8911)
https://github.com/python/cpython/commit/8fdd331bbf7e60dd81c02c7077f44c7939e2a05d


--
nosy: +benjamin.peterson
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



[issue34496] Argparse library: parse --set type

2018-08-25 Thread fralau


New submission from fralau :

With argparse, an common requirement is is that a user may want to pass a 
series of key/value pairs (a sort of equivalent of **args on the command line). 
Here is a solution that could be implemented in the standard library with 
little effort.

This can be done so, e.g.:
command --set foo=hello bar="hello world" baz=5

With the benefit of experience, this is easy and very intuitive.

This does not require any modification, as the '--set' option can be defined 
as:  
   nargs='+',
   metavar="KEY=VALUE"

The next step is to parse the resulting list.

See github gist for a trivial implementation: 
https://gist.github.com/fralau/061a4f6c13251367ef1d9a9a99fb3e8d). 

It might be useful to integrate a helper method to the standard library 
together with an explanation in the doc on how to do it.

--
components: Library (Lib)
messages: 324043
nosy: fralau
priority: normal
severity: normal
status: open
title: Argparse library: parse --set type
type: enhancement

___
Python tracker 

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



[issue34495] excess_args asserts if args == nullptr

2018-08-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

object_new and object_init should not be called with args == NULL. This looks 
like a bug in the user code.

Even without assert(PyTuple_Check(args)) in PyTuple_GET_SIZE it dereferences 
the NULL pointer if args == NULL.

Unless there is a code in CPython implementation itself which calls object_new 
and object_init with args == NULL this issue will be closed as not a bug.

--
nosy: +serhiy.storchaka
resolution:  -> not a bug

___
Python tracker 

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



  1   2   >