[issue22363] argparse AssertionError with add_mutually_exclusive_group and help=SUPPRESS

2014-09-09 Thread paul j3

paul j3 added the comment:

This assertion has triggered several bug issues, either due to an empty group 
like this, or certain characters in the metavars.

http://bugs.python.org/issue17890
'argparse: mutually exclusive groups full of suppressed args can cause 
AssertionErrors'

http://bugs.python.org/issue11874 
'argparse assertion failure with brackets in metavars'

http://bugs.python.org/issue16360 
'argparse: comma in metavar causes assertion failure when formatting long usage 
message'

I think this is a duplicate of 17890, though I'll have to look more closely at 
your patch to see what it adds.

For 11874 I proposed a major rewrite of the usage formatting.  There I format 
each group and/or action separately, and keep the pieces in a list.  That way 
it's easier to filter out empty pieces, and avoids the complex split that gives 
headaches when the usage is long enough to wrap.

--
nosy: +paul.j3

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



[issue20752] Difflib should provide the option of overriding the SequenceMatcher

2014-09-09 Thread Chris Rose

Chris Rose added the comment:

What's the word on this change?

--

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



[issue22365] SSLContext.load_verify_locations(cadata) does not accept CRLs

2014-09-09 Thread Ralph Broenink

Ralph Broenink added the comment:

Here's a minimal example of the issue, assuming you have obtained a CRL in PEM 
format, e.g. from https://www.emulab.net/genicrl.bundle:


import ssl
context = ssl.create_default_context()

path = 'path/to/crl.crl'

# Working:
context.load_verify_locations(cafile=path)

# Not working:
with open(path, 'r') as f:
context.load_verify_locations(cadata=f.read())


Replacing the path to the CRL with a path to a CA works in both cases.

--

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



[issue11874] argparse assertion failure with brackets in metavars

2014-09-09 Thread Zacrath

Changes by Zacrath mrdoom...@gmail.com:


--
nosy: +Zacrath

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



[issue22363] argparse AssertionError with add_mutually_exclusive_group and help=SUPPRESS

2014-09-09 Thread Zacrath

Zacrath added the comment:

I've confirmed that this is a duplicate of issue 17890.

In case anyone needs it, a workaround is to move the mutually exclusive group 
to the end of the arguments.

--

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



[issue22326] tempfile.TemporaryFile fails on NFS v4 filesystems

2014-09-09 Thread Frank Thommen

Frank Thommen added the comment:

It might be an issue of strict ACL mapping 
(http://wiki.linux-nfs.org/wiki/index.php/ACLs) is implemented.  On our ZFS 
based NFS v4 server this is the case, on CentOS based NFS v4 servers this 
doesn't seem to be implemented/enforced.

It becomes then still a Python problem, as tempfile.TemporaryFile is not 
generally usable any more.

--

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



[issue22361] Ability to join() threads in concurrent.futures.ThreadPoolExecutor

2014-09-09 Thread Luca Falavigna

Luca Falavigna added the comment:

There is indeed little benefit in freeing up resources left open by a unused 
thread, but it could be worth closing it for specific needs (e.g. thread 
processes sensible information) or in embedded systems with very low resources.

--

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



[issue19494] urllib2.HTTPBasicAuthHandler (or urllib.request.HTTPBasicAuthHandler) doesn't work with GitHub API v3 and similar

2014-09-09 Thread Matej Cepl

Matej Cepl added the comment:

 The patch for Python 3.5, however, looks great.

So, could we get some resolution here, please? Before this bug celebrates a 
first birthday, could somebody decide what to do? Whom should I pester? Who has 
the responsibility to make a decision?

--

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



[issue1525806] Tkdnd mouse cursor handling patch

2014-09-09 Thread Philippe Devalkeneer

Changes by Philippe Devalkeneer phil.le.bienheur...@gmail.com:


--
nosy: +flupke

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



[issue18232] running a suite with no tests is not an error

2014-09-09 Thread Michael Foord

Michael Foord added the comment:

I'd agree that a test run that actually runs zero tests almost always indicates 
an error, and it would be better if this was made clear. 

I have this problem a great deal with Go, where the test tools are awful, and 
it's very easy to think you have a successful test run (PASS) when you actually 
ran zero tests.

Particularly with discovery you will want to know your invocation is wrong.

I'm agnostic on a new --min-tests parameter, but having zero tests found 
should return a non-zero exit code and display a warning.

--

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



[issue22359] Remove incorrect uses of recursive make

2014-09-09 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue7744] Allow site.addsitedir insert to beginning of sys.path

2014-09-09 Thread Michael R. Bernstein

Michael R. Bernstein added the comment:

The lack of a left-append option for site.addsitedir(path), or an 
site.insertsitedir(index, path) (which is what I would consider a better 
solution), causes quite a few contortions on some hosted platforms, notably 
Google App Engine, for vendored packages.

I've been trying to find a more elegant solution than the following code, but 
haven't been able to find anything:

import os
import site
import sys

dirname = 'lib'
dirpath = os.path.join(os.path.dirname(__file__), dirname)

sys.path, remainder = sys.path[:1], sys.path[1:]
site.addsitedir(dirpath)
sys.path.extend(remainder)

And even asked on StackOverflow: 
http://stackoverflow.com/questions/25709832/what-is-the-cleanest-way-to-add-a-directory-of-third-party-packages-to-the-begin

Having a site.insertsitedir(index, path) available would make things so much 
simpler.

--
nosy: +webmaven
versions: +Python 3.3, Python 3.4, Python 3.5

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2014-09-09 Thread R. David Murray

R. David Murray added the comment:

Thanks for tackling this.  It's been bugging me almost daily this past week, 
but as usual when this bug is in my face I had no time to actually work on a 
fix.

I applied this patch to default,  put an invalid import in test_os, and this is 
the result:

rdmurray@pydev:~/python/p35./python -m unittest test.test_os
Traceback (most recent call last):
  File /home/rdmurray/python/p35/Lib/unittest/loader.py, line 140, in 
loadTestsFromName
module = __import__(module_name)
  File /home/rdmurray/python/p35/Lib/test/test_os.py, line 5, in module
import foobar
ImportError: No module named 'foobar'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File /home/rdmurray/python/p35/Lib/runpy.py, line 170, in 
_run_module_as_main
__main__, mod_spec)
  File /home/rdmurray/python/p35/Lib/runpy.py, line 85, in _run_code
exec(code, run_globals)
  File /home/rdmurray/python/p35/Lib/unittest/__main__.py, line 18, in 
module
main(module=None)
  File /home/rdmurray/python/p35/Lib/unittest/main.py, line 92, in __init__
self.parseArgs(argv)
  File /home/rdmurray/python/p35/Lib/unittest/main.py, line 139, in parseArgs
self.createTests()
  File /home/rdmurray/python/p35/Lib/unittest/main.py, line 146, in 
createTests
self.module)
  File /home/rdmurray/python/p35/Lib/unittest/loader.py, line 202, in 
loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
  File /home/rdmurray/python/p35/Lib/unittest/loader.py, line 202, in 
listcomp
suites = [self.loadTestsFromName(name, module) for name in names]
  File /home/rdmurray/python/p35/Lib/unittest/loader.py, line 145, in 
loadTestsFromName
next_attribute, self.suiteClass)
ValueError: need more than 1 value to unpack

I get similar errors if I misspell the module name in on the command line.

From my point of view this is still an improvement over the status quo, but I 
don't think it is what you had in mind :).

--

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



[issue21270] unittest.mock.call object has inherited count method

2014-09-09 Thread Kushal Das

Kushal Das added the comment:

Forgot to attach the patch. Includes NEWS entry. Overriden methods count() and 
index().

--
keywords: +patch
Added file: http://bugs.python.org/file36581/issue21270.patch

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



[issue22364] Unify error messages of re and regex

2014-09-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, the idea of this issue is to enhance the re module (and the regex module 
if Matthew will) be picking the best error messages (or writing a new one).

--
assignee:  - serhiy.storchaka

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



[issue22338] test_json crash on memory allocation failure

2014-09-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Besides my nitpick on Rietveld the patch LGTM.

--
nosy: +serhiy.storchaka

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



[issue21951] tcl test change crashes AIX

2014-09-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka

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



[issue21951] tcl test change crashes AIX

2014-09-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As Victor noted on IRC, ckalloc() panics and doesn't returns NULL in case of 
error. We should use attemptckalloc() instead.

--
stage: needs patch - patch review
Added file: http://bugs.python.org/file36582/tkinter_ckallock.patch

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



[issue14076] sqlite3 module ignores placeholders in CREATE TRIGGER code

2014-09-09 Thread Matthew Barnett

Matthew Barnett added the comment:

For comparison:

Python 3.1.3:
[(b'',)]

Python 3.2.5:
[(None,)]

Python 3.3.5:
[(b'',)]

Python 3.4.1:
sqlite3.OperationalError: trigger cannot use variables

--
nosy: +mrabarnett

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



[issue4972] context management support in imaplib, smtplib, ftplib

2014-09-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Berker.

--
assignee:  - serhiy.storchaka

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



[issue22364] Unify error messages of re and regex

2014-09-09 Thread Matthew Barnett

Matthew Barnett added the comment:

 re:Cannot process flags argument with a compiled pattern
 regex: can't process flags argument with a compiled pattern

Error messages usually start with a lowercase letter, and I think that all the 
other ones in the re module do.

By the way, which is preferred, cannot or can't? The regex module always 
uses can't, but re module uses cannot except for TypeError: can't use a 
bytes pattern on a string-like object, I think.

Also, you said that one of the re module's messages was better, but didn't say 
which! Did you mean this one?

 re:expected bytes, bytearray, or an object with the buffer interface, str 
 found
 regex: expected bytes instance, str found

--

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



[issue4972] context management support in imaplib, smtplib, ftplib

2014-09-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think that's all with this issue.

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

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



[issue22369] context management protocol vs context manager protocol

2014-09-09 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Both terms are used in the documentation. Currently context manager wins 
(with score 225:19 in rst files). We should unify terminology across the 
documentation.

--
assignee: docs@python
components: Documentation
messages: 226643
nosy: docs@python, eric.araujo, ezio.melotti, georg.brandl, serhiy.storchaka
priority: normal
severity: normal
status: open
title: context management protocol vs context manager protocol
versions: Python 2.7, Python 3.4, Python 3.5

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



[issue22370] pathlib OS detection

2014-09-09 Thread Antony Lee

New submission from Antony Lee:

Currently, pathlib contains the following check for the OS in the import 
section:

try:
import nt
except ImportError:
nt = None
else:
if sys.getwindowsversion()[:2] = (6, 0):
from nt import _getfinalpathname
else:
supports_symlinks = False
_getfinalpathname = None

I would like to suggest to switch this on testing for the value of `os.name` 
(as `PurePath.__new__` does), or possibly testing whether 
`sys.getwindowsversion` exists: the `nt` module is not publicly defined, so it 
wouldn't be unreasonable to have a file named `nt.py` on an Unix system (where 
this shouldn't cause any problems), in which case importing `pathlib` raises an 
AttributeError at the `getwindowsversion` line.

--
components: Library (Lib)
messages: 226644
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: pathlib OS detection
versions: Python 3.4, Python 3.5

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



[issue21122] CPython fails to build modules with LLVM LTO on Mac OS X

2014-09-09 Thread Jonas Wagner

Jonas Wagner added the comment:

No response for a while, and problem solved... closing.

--
resolution:  - fixed
status: open - closed

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



[issue5309] distutils doesn't parallelize extension module compilation

2014-09-09 Thread Jonas Wagner

Jonas Wagner added the comment:

I've checked the `dlopen` issue. This was due to a problem with 
UndefinedBehaviorSanitizer, and was solved by upgrading to Clang 3.5. It has 
little to do with this patch.

Using this patch and http://bugs.python.org/issue22359 , I now get reliable 
parallel builds.

--

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



[issue22369] context management protocol vs context manager protocol

2014-09-09 Thread R. David Murray

R. David Murray added the comment:

I think context management protocol is the better English phrasing.  
(grepping just for the full phrase I make it 38 vs 22, but I of course I may 
have missed some that are broken across lines).

--
nosy: +r.david.murray

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



[issue21147] sqlite3 doesn't complain if the request contains a null character

2014-09-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is revised patch. There is yet one way to create Statement instance 
(Connection.__call__) and this patch covers it too.

--
stage: needs patch - patch review
Added file: http://bugs.python.org/file36583/sqlite_null_2.patch

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



[issue22284] decimal module contains less symbols when the _decimal module is missing

2014-09-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2b3dbbd2bd92 by Stefan Krah in branch '3.4':
Issue #22284: Update decimal.__all__
http://hg.python.org/cpython/rev/2b3dbbd2bd92

New changeset 5bc23c111de1 by Stefan Krah in branch 'default':
Issue #22284: Merge 3.4
http://hg.python.org/cpython/rev/5bc23c111de1

--
nosy: +python-dev

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



[issue22371] tests failing with -uall and http_proxy and https_proxy set

2014-09-09 Thread Matthias Klose

New submission from Matthias Klose:

there are some tests failing when http_proxy and https_proxy is set and the 
network resource is enabled.  I didn't analyze things, but I assume there needs 
some more fine-grained control about the network resource.

the log of such a run is attached.  the system doesn't have any outward 
connection besides the http_proxy and https_proxies.

--
files: python3.4-net-tests
messages: 226650
nosy: doko
priority: normal
severity: normal
status: open
title: tests failing with -uall and http_proxy and https_proxy set
Added file: http://bugs.python.org/file36584/python3.4-net-tests

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



[issue22284] decimal module contains less symbols when the _decimal module is missing

2014-09-09 Thread Stefan Krah

Stefan Krah added the comment:

I didn't add __all__ to _decimal because of this thread here:

https://mail.python.org/pipermail/python-dev/2001-February/012591.html

--
components: +Library (Lib)
dependencies:  -Speed up _decimal import
resolution:  - fixed
stage:  - resolved
status: open - closed
type:  - behavior
versions: +Python 3.4

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



[issue22371] tests failing with -uall and http_proxy and https_proxy set

2014-09-09 Thread Matthias Klose

Matthias Klose added the comment:

forgot: some tests fail as well with -uall,-network and configured proxies.

--

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



[issue22369] context management protocol vs context manager protocol

2014-09-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

You are right, I missed that the context manager is separate term.

Here is a patch.

--
keywords: +patch
stage:  - patch review
Added file: 
http://bugs.python.org/file36585/doc_context_management_protocol.patch

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



[issue22373] PyArray_FromAny tries to deallocate double: 12 (d)

2014-09-09 Thread Riccardo

New submission from Riccardo:

Hi,
I found this strange behaviour of PyArray_FromAny that manifest only inside a 
parallel region of openmp.
I am using python 2.7.4 and numpy 1.8.0

*** Reference count error detected
an attempt was made to deallocate 12 (d) ***
and this is due to the PyArray_FromAny function that apparently does something 
also to the reference of NPY_DOUBLE or invisibly uses some kind of global 
variable generating race condition in a parallel implementation?
If i insert PyArray_FromAny in a critical region the error never pops up.

Best Regards,
Riccardo

P.s. i tried to send you more details and a piece of code but some characters 
are not accepted by your e-mail, ask me if you want more details

--
messages: 226655
nosy: Il_Fox
priority: normal
severity: normal
status: open
title: PyArray_FromAny tries to deallocate double: 12 (d)

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



[issue22369] context management protocol vs context manager protocol

2014-09-09 Thread R. David Murray

R. David Murray added the comment:

Patch looks fine to me.  I don't know that the HISTORY/NEWS changes are really 
needed, but I suppose they don't hurt.

--

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



[issue20752] Difflib should provide the option of overriding the SequenceMatcher

2014-09-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Current status: Tim is currently not actively involved in Python development 
and no one who is active is enthusiastic about the proposal.

Your proposal is to add dependency injection to the initializer for the 4 diff 
classes by adding 6 new parameters. I will comment on the proposal itself 
below.  But first...

Your initial message in support of the proposal was about as weak as possible: 
it would be possible to   Lots of things are possible. For instance, we 
could add a Socket class replacement parameter to all stdlib functions and 
classes that use socket.Socket (and this has been requested in at least one 
case).  However, only a few changes actually get done.  Recognizing this ...

Your later message gave one use case: Bazaar's experiments with an alternate 
implementation.  To me, this example is still inadequate justification for a 
change. We agree that cut-and-paste is bad (though not terrible for one-off 
experiments).  That is why Python allows dynamic patching ('monkeypatching') of 
modules and Python-coded classes as an alternative (though subclassing is often 
better for classes).

import difflib
# either
class MyDiff: pass  # not really ;-)
# MyDiff might or might not subclass SequenceMatcher
difflib.SequenceMatcher = MyDiff
# or
def f(self, *args): pass  # again, not really
difflib.SequenceMatcher.somemethod = f
# either way, use difflib functions with alternate matcher.

I consider subclassing + dynamic patching an adequate solution* for the one use 
case you mention and likely other uses.  So I am inclined to reject the 
proposal as 'unnecessary'.  (If multiple people were routinely monkeypatching 
difflib like this, I might change my mind.)

* A context manager can be used to make the monkeypatching temporary and 
therefore local in effect. The following works.

@contextlib.contextmanager
def mp(ob, attr, new):
old = getattr(ob, attr)
setattr(ob, attr, new)
yield
setattr(ob, attr, old)


As for the proposal itself: you mention possible API alternatives.  I am more 
concerned about expanding our responsibility and corresponding test 
requirements.  If you monkeypatch the module, then you are responsible for the 
results.  If we add what amount to monkeypatching parameters, then we become 
responsible.  We would have to make sure that the requirements for replacements 
are adequately defined and design at least one non-trivial replacement and run 
all the appropriate tests with that replacement.  Your patch does not do this.  
I would not want to do this. We would also have to be prepared to maintain the 
expanded definition of the classes.

Extending the mandate of the four classes from work reasonably well with the 
builtin diff engine to work reasonably well with any 'similar' diff engine 
passed in by a user is not as trivial as implied by the patch.

For a simple function like filter, the requirement for the function parameter 
is simple.  It must be a predicate with respect to the items yielded by the 
iterable arguments.  That means returning False or True and never raising when 
applied to each item.  It is easy to create alternatives such as lambda x: 
False, lambda x: True, lambda x: bool(x), and lambda x: x  0, and test with 
appropriate iterables.

I hope this explains a bit why function parameters are routine in Python while 
class parameters are much less common.

--

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2014-09-09 Thread Robert Collins

Robert Collins added the comment:

You may need to apply the patch from http://bugs.python.org/issue19746 first as 
well - I was testing with both applied.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7559
___
___
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

2014-09-09 Thread Rose Ames

Rose Ames added the comment:

Changing the imports only is straightforward, but I'm having trouble detecting 
and changing future uses of the variables, without also clobbering user-defined 
variables with the same names.

I notice some of the current fixers have similar problems, for example the 
itertools fixer changes:


```
def imap(): pass
imap()
```

to
 

```
def imap(): pass
map()
```

This patch is a little smarter than that, but it only detects top-level 
definitions.  For example, the lowercase in 


```
class Foo:
  def __init__(self):
self.lowercase = blargh
```

still gets renamed.

I can work on this more, but would like to know:

a) whether this fix is still wanted
b) how smart it needs to be
c) whether my approach is reasonable.  I feel like there should be an easier 
way.

--
keywords: +patch
nosy: +superluser
Added file: http://bugs.python.org/file36586/string_partial.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13272
___
___
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

2014-09-09 Thread Rose Ames

Rose Ames added the comment:

...

d) how to format code :\

--

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



[issue22374] Replace contextmanager example and improve explanation

2014-09-09 Thread Terry J. Reedy

New submission from Terry J. Reedy:

https://docs.python.org/3/library/contextlib.html#contextlib.contextmanager
The current html contextmanager example is 'not recommended' for actual use, 
because there are better ways to accomplish the same goal.  To me, is also 
unsatifactory in that the context management is only metaphorical (conceptual) 
and not actual.

I propose the following as a replacement. It actually manages context and is, I 
believe, both useful and currently* the best way to accomplish the goal of 
temporarily monkeypatching a module,  It was directly inspired by #20752, see 
msg226657, though there have been other issues where monkeypatching as a 
solution has been discussed.

---
from contextlib import contextmanager
import itertools as its

@contextmanager
def mp(ob, attr, new):
old = getattr(ob, attr)
setattr(ob, attr, new)
yield
setattr(ob, attr, old)

def f(): pass

print(its.count, its.cycle)
with mp(its, 'count', f), mp(its, 'cycle', f):
print(its.count, its.cycle)
print(its.count, its.cycle)

# class 'itertools.count'
# function f at 0x035A91E0
# class 'itertools.count'
---

I am aware that the above does not follow the current style, which I dislike, 
of confusingly mixing together batch file code and interactive input code.  I 
think the above is how the example should be written.  It would work even 
better if Sphinx gave comment lines a different background color. (A '##' 
prefix could be used to differentiate code comments from commented-out output 
lines.)

In the same section, I find the following paragraph a bit confusing (perhaps is 
tries to say too much):

contextmanager() uses ContextDecorator so the context managers it creates can 
be used as decorators as well as in with statements. When used as a decorator, 
a new generator instance is implicitly created on each function call (this 
allows the otherwise “one-shot” context managers created by contextmanager() to 
meet the requirement that context managers support multiple invocations in 
order to be used as decorators).

I am guessing that this means, among other things, that ContextDecorator is 
necessary and sufficient to use mp twice in one with statement.  I 
intentionally added the double use to the example to make this possibility 
clear.

* The only better way I know of would be if mp (spelled out as 'monkeypatch' 
were considered useful enough to be added to contextlib.

--
assignee: docs@python
components: Documentation
messages: 226661
nosy: docs@python, ncoghlan, terry.reedy
priority: normal
severity: normal
status: open
title: Replace contextmanager example and improve explanation
versions: Python 2.7, Python 3.4, Python 3.5

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



[issue22375] urllib2.urlopen().read().splitlines() opening a directory in a FTP server randomly returns incorrect results

2014-09-09 Thread Alan Evangelista

New submission from Alan Evangelista:

Examples in Python command line:

Try 1
-

 import urllib2
urllib2.urlopen('ftp://user:password@server/packages/repodata').read().splitlines()

Output:
list of files

Try 2
-

 import urllib2
urllib2.urlopen('ftp://user:password@server/packages/repodata').read().splitlines()

Output:
[]


If I split urllib2.urlopen().read().splitlines() statement in 2 statements 
(urllib2.urlopen() and read().splitlines()), I always get correct results.

import urllib2
a = 
urllib2.urlopen('ftp://alan_infinite:pass4root@9.8.234.55/packages/repodata')
 a.read().splitlines()

Output:
file_list


Verified in Python 2.6.6 in RHEL 6.4, Python 2.7.x in RHEL 7 and Python 2.7.3 
in Ubuntu 14.04

--
components: Library (Lib)
messages: 226662
nosy: alanoe
priority: normal
severity: normal
status: open
title: urllib2.urlopen().read().splitlines() opening a directory in a FTP 
server randomly returns incorrect results
type: behavior
versions: Python 2.7

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



[issue22375] urllib2.urlopen().read().splitlines() opening a directory in a FTP server randomly returns incorrect results

2014-09-09 Thread Alan Evangelista

Changes by Alan Evangelista ala...@br.ibm.com:


--
status: open - closed

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2014-09-09 Thread R. David Murray

R. David Murray added the comment:

OK, with both patches applied the output looks good.  With a bit of luck I'll 
have some time to actually review the patches in a couple of hours.

--

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



[issue22376] urllib2.urlopen().read().splitlines() opening a directory in a FTP server randomly returns incorrect result

2014-09-09 Thread Alan Evangelista

New submission from Alan Evangelista:

Examples in Python command line:

Try 1
-

 import urllib2
urllib2.urlopen('ftp://user:password@server/packages/repodata').read().splitlines()

Output:
list of files

Try 2
-

 import urllib2
urllib2.urlopen('ftp://user:password@server/packages/repodata').read().splitlines()

Output:
[]


If I split urllib2.urlopen().read().splitlines() statement in 2 statements 
(urllib2.urlopen() and read().splitlines()), I always get correct results.

import urllib2
a = urllib2.urlopen('ftp://user:password@server/packages/repodata')
 a.read().splitlines()

Output:
file_list


Verified in Python 2.6.6 in RHEL 6.4, Python 2.7.x in RHEL 7 and Python 2.7.3 
in Ubuntu 14.04

--
components: Library (Lib)
messages: 226664
nosy: alanoe
priority: normal
severity: normal
status: open
title: urllib2.urlopen().read().splitlines() opening a directory in a FTP 
server randomly returns incorrect result
type: behavior
versions: Python 2.7

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



[issue22375] urllib2.urlopen().read().splitlines() opening a directory in a FTP server randomly returns incorrect results

2014-09-09 Thread R. David Murray

R. David Murray added the comment:

I think this was already fixed in issue 15002.

--
nosy: +orsenthil, r.david.murray

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2014-09-09 Thread Robert Collins

Robert Collins added the comment:

This is what I see in my tree:

E
==
ERROR: test_os (unittest.loader.ModuleImportFailure)
--
Traceback (most recent call last):
  File /home/robertc/work/cpython/Lib/unittest/case.py, line 58, in 
testPartExecutor
yield
  File /home/robertc/work/cpython/Lib/unittest/case.py, line 577, in run
testMethod()
  File /home/robertc/work/cpython/Lib/unittest/loader.py, line 36, in 
testFailure
raise exception
ImportError: Failed to import test module: test_os
Traceback (most recent call last):
  File /home/robertc/work/cpython/Lib/unittest/loader.py, line 146, in 
loadTestsFromName
module = __import__(module_name)
  File /home/robertc/work/cpython/Lib/test/test_os.py, line 5, in module
import broken
ImportError: No module named 'broken'

--

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2014-09-09 Thread Robert Collins

Robert Collins added the comment:

Raced with your comment. Great - and thanks!

--

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



[issue22377] %Z in strptime doesn't match EST and others

2014-09-09 Thread Ram Rachum

New submission from Ram Rachum:

The documentation for %Z ( 
https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior ) 
says it matches `EST` among others, but in practice it doesn't: 

Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 
bit (AMD64)] on win32
Type copyright, credits or license() for more information.
DreamPie 1.2.1
 import datetime
 datetime.datetime.strptime('2016-12-04 08:00:00 UTC', '%Y-%m-%d 
%H:%M:%S %Z')
0: datetime.datetime(2016, 12, 4, 8, 0)
 datetime.datetime.strptime('2016-12-04 08:00:00 EST', '%Y-%m-%d 
%H:%M:%S %Z')
Traceback (most recent call last):
  File pyshell#2, line 1, in module
datetime.datetime.strptime('2016-12-04 08:00:00 EST', '%Y-%m-%d 
%H:%M:%S %Z')
  File C:\Python34\lib\_strptime.py, line 500, in _strptime_datetime
tt, fraction = _strptime(data_string, format)
  File C:\Python34\lib\_strptime.py, line 337, in _strptime
(data_string, format))
ValueError: time data '2016-12-04 08:00:00 EST' does not match format 
'%Y-%m-%d %H:%M:%S %Z'


--
components: Library (Lib)
messages: 226668
nosy: cool-RR
priority: normal
severity: normal
status: open
title: %Z in strptime doesn't match EST and others
type: behavior
versions: Python 3.4

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



[issue22373] PyArray_FromAny tries to deallocate double: 12 (d)

2014-09-09 Thread Josh Rosenberg

Josh Rosenberg added the comment:

This sounds like a bug in Numpy. You should probably post it to their tracker: 
https://github.com/numpy/numpy/issues

--
nosy: +josh.rosenberg

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



[issue22377] %Z in strptime doesn't match EST and others

2014-09-09 Thread R. David Murray

R. David Murray added the comment:

Looking at the code, the only timezone strings it recognizes are utc, gmt, and 
whatever is in time.tzname (EST and EDT, in my case).

This seems...barely useful, although clearly not useless :)

And does not seem to be documented.

--
nosy: +belopolsky, r.david.murray

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



[issue19746] No introspective way to detect ModuleImportFailure in unittest

2014-09-09 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


Added file: http://bugs.python.org/file36587/issue19746-rebased.patch

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



[issue19746] No introspective way to detect ModuleImportFailure in unittest

2014-09-09 Thread R. David Murray

R. David Murray added the comment:

Your patch isn't diffed against a revision from the cpython repo, and 
apparently didn't apply cleanly to tip, so no review link was generated.  I  
uploaded a rebased patch to review, but don't actually have any line by line 
comments.

You are right about the docs.  Reading that, I thought it was saying that 
errors would have a list of the errors that show up in the summary as Errors=N, 
and not the ones that show up as Failures=N, which of course is completely off 
base for two reasons (but, then, I can never remember the difference between 
Failure and Error and always ignore what type the test failures are).

Anyway, you probably want to talk about actual error types.  I understand 
ImportError, but I have no idea what would trigger the 'Failed to call 
load_tests' error.  Nor is it clear what would be a fatal error (easier just to 
say which errors are trapped, I think). It should also be mentioned that the 
contents of the list are an error message followed by a full traceback.  And, 
frankly, I'm not sure why this is useful, and in particular why this 
implementation satisfies your use case.

(I'm more interested in the issue 7559 patch, but since it based on this one I 
don't think I can just rebase it to review it.)

--
nosy: +r.david.murray

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



[issue22366] urllib.request.urlopen shoudl take a context (SSLContext) argument

2014-09-09 Thread Senthil Kumaran

Senthil Kumaran added the comment:

With the final review comment addressed, this could go in. Since you have 
commit rights, please feel free to commit it. (else, please assign this to me 
and I will commit and follow up with the buildbots)

--

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



[issue22378] SO_MARK support for Linux

2014-09-09 Thread jpv

New submission from jpv:

Please add support for SO_MARK in socket module.

From man 7 socket:

SO_MARK (since Linux 2.6.25): Set the mark for each packet sent through this  
socket  (similar to  the  netfilter  MARK target but socket-based).  Changing 
the mark can be used for mark-based routing without netfilter or for packet
filtering. Setting   this   option   requires   the CAP_NET_ADMIN capability.

--
components: Extension Modules
files: python-so_mark.patch
keywords: patch
messages: 226673
nosy: jpv
priority: normal
severity: normal
status: open
title: SO_MARK support for Linux
type: enhancement
versions: Python 2.7, Python 3.4
Added file: http://bugs.python.org/file36588/python-so_mark.patch

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



[issue22366] urllib.request.urlopen shoudl take a context (SSLContext) argument

2014-09-09 Thread Senthil Kumaran

Changes by Senthil Kumaran sent...@uthcode.com:


--
assignee:  - alex

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



[issue19746] No introspective way to detect ModuleImportFailure in unittest

2014-09-09 Thread Robert Collins

Robert Collins added the comment:

Thanks; I'm still learning how to get the system here to jump appropriately :). 
I thought I'd told hg to reset me to trunk...

You are right about the docs.  Reading that, I thought it was saying that 
errors would have a list of the errors that show up in the summary as Errors=N, 
and not the ones that show up as Failures=N, which of course is completely off 
base for two reasons (but, then, I can never remember the difference between 
Failure and Error and always ignore what type the test failures are).

Ah, so this is specifically about *loader* errors, nothing to do with the ERROR 
and FAILURE concepts for the TestResult class; that definitely needs to be made 
more clear.

Anyway, you probably want to talk about actual error types.  I understand 
ImportError, but I have no idea what would trigger the 'Failed to call 
load_tests' error.  Nor is it clear what would be a fatal error (easier just to 
say which errors are trapped, I think).

'Failed to call load_tests' is an existing error that can be triggered if a 
load_tests method errors.

e.g. put this in a test_foo.py:

def load_tests(loader, tests, pattern):
raise Exception('fred')

to see it with/without the patch. I'll take a stab at improving the docs in a 
bit.

It should also be mentioned that the contents of the list are an error message 
followed by a full traceback.  And, frankly, I'm not sure why this is useful, 
and in particular why this implementation satisfies your use case.

Ah! So I have an external runner which can enumerate the tests without running 
them. This is useful when the test suite is being distributed across many 
machines (simple hash based distribution can have very uneven running times, so 
enumerating the tests that need to run then scheduling based on runtime (or 
other metadata) gets better results). If the test suite can't be imported I 
need to show the failure of the import to users so they can fix it, but since 
the test suite may take hours (or even not be runnable locally) I need to do 
this without running the tests. Thus a simple list of the tracebacks 
encountered loading the test suite is sufficient. Where would be a good place 
to make this clearer?

--

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



[issue22379] Empty exception message of str.join

2014-09-09 Thread Yongzhi Pan

New submission from Yongzhi Pan:

In the 2.7 branch, the exception message of str.join is missing when the 
argument is non-sequence:

 ' '.join(None)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError

I fix this with a patch. After this:

 ' '.join(None)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: can only join an iterable

I also add test to this case. Can the test also be added to 3.x branches?

--
components: ctypes
files: str_join_exception_message.diff
keywords: patch
messages: 226675
nosy: fossilet
priority: normal
severity: normal
status: open
title: Empty exception message of str.join
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file36589/str_join_exception_message.diff

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



[issue22366] urllib.request.urlopen shoudl take a context (SSLContext) argument

2014-09-09 Thread Alex Gaynor

Alex Gaynor added the comment:

Replied to the review; let me know if you agree with my comment.

--
assignee: alex - orsenthil

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



[issue22373] PyArray_FromAny tries to deallocate double: 12 (d)

2014-09-09 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


--
resolution:  - third party
status: open - closed

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



[issue22373] PyArray_FromAny tries to deallocate double: 12 (d)

2014-09-09 Thread Stefan Behnel

Stefan Behnel added the comment:

Agreed that it's not a bug in CPython, but my guess is that it's not a bug in 
NumPy either. The C function you call (which IIRC creates a new NumPy array) 
almost certainly needs the GIL to protect it against race conditions, and since 
you mentioned OpenMP, you most likely released the GIL. So, just re-acquire the 
GIL around the call (and make sure you don't have any other threading problems 
in your code).

--
nosy: +scoder

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



[issue22380] Y2K compliance section in FAQ is 14 years too old

2014-09-09 Thread Elizabeth Myers

New submission from Elizabeth Myers:

As seen at 
https://docs.python.org/3/faq/general.html#is-python-y2k-year-2000-compliant; 
this is 2014 - Y2K compliance hasn't been a relevant topic for, well, 14 years, 
and I doubt this is a frequently asked question nowadays. The As of August 
2003 portion is even out of date (11 years old!).

IMHO this ought to be taken out of the docs, unless this is still something 
people are asking about.

--
assignee: docs@python
components: Documentation
messages: 226678
nosy: Elizacat, docs@python
priority: normal
severity: normal
status: open
title: Y2K compliance section in FAQ is 14 years too old
type: enhancement
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue20132] Many incremental codecs don’t handle fragmented data

2014-09-09 Thread Martin Panter

Martin Panter added the comment:

Stream reader interfaces suffer the same problem. Test cases:

codecs.getreader(unicode-escape)(BytesIO(br\u2013)).read(1)
codecs.getreader(hex-codec)(BytesIO(b33)).read(1)
codecs.getreader(base64-codec)(BytesIO(bAA==)).read(1)
TestCase().assertEqual(b=, 
codecs.getreader(quopri-codec)(BytesIO(b=3D)).read(1))

Even though the “zlib” incremental decoder is okay, its stream reader still 
suffers this problem. I was going to check for zip bomb behaviour when you call 
read() with a limited number of input “characters”, but got this instead:

 codecs.getreader(zlib-codec)(bomb).read(1, 1)
zlib.error: Error -5 while decompressing data: incomplete or truncated stream

Similar problems with stream writers, for instance:

 w = codecs.getwriter(base64-codec)(BytesIO())
 w.write(b1); w.write(b2); w.reset(); w.getvalue()
b'MQ==\nMg==\n'  # Should be bMTI=\n

I also noticed StreamWriter.writelines() assumes it is encoding text, and does 
not work at least with “base64-codec”:

 codecs.getwriter(base64-codec)(BytesIO()).writelines((b1, b2))
TypeError: sequence item 0: expected str instance, bytes found

--
versions: +Python 3.4

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



[issue13881] Stream encoder for zlib_codec doesn't use the incremental encoder

2014-09-09 Thread Martin Panter

Martin Panter added the comment:

The corresponding stream reader has a related issue which I mentioned in Issue 
20132

--

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



[issue13881] Stream encoder for zlib_codec doesn't use the incremental encoder

2014-09-09 Thread Martin Panter

Martin Panter added the comment:

Even if all these issues aren’t worth fixing, I think the documentation should 
at least say which codecs work fully (e.g. most text encodings), which ones 
work suboptimally (e.g. UTF-7), and which ones only work for single-shot 
encoding and decoding.

--

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



[issue20506] Command to display all available Import Library

2014-09-09 Thread Martin Panter

Martin Panter added the comment:

I wrote some code that does something like this for a hacky custom readline 
completer. See the import_list() method at 
https://github.com/vadmium/etc/blob/6ac333f/python/pythonstartup.py#L222. It 
looks like I’m using a combination of “sys.builtin_module_names” and 
pkgutil.iter_modules(), with a whole lot of compatibility and bug workarounds.

--
nosy: +vadmium

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