[issue17323] Disable [X refs, Y blocks] ouput in debug builds

2013-03-01 Thread Ezio Melotti

New submission from Ezio Melotti:

I suggest to disable the [X refs, Y blocks] ouput in debug builds by default, 
and provide an option to enable it if/when necessary.
Most of the time these values are not necessary, and they end up getting in the 
way while copy/pasting code from the interpreter and/or running tests (we even 
have a function in test.support to get rid of them).
They are sometimes useful while investigating refleaks, so there should still 
be an option to enable it.  I'm not sure what would be the best way to do it (a 
new python flag?).

--
components: Interpreter Core
messages: 183244
nosy: ezio.melotti
priority: normal
severity: normal
stage: needs patch
status: open
title: Disable [X refs, Y blocks] ouput in debug builds
type: enhancement
versions: Python 3.4

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



[issue11955] 3.3 : test_argparse.py fails 'make test'

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

The attached patch adds the list of args to the output of assertRaises in case 
of error, e.g.:
FAIL: test_failures_one_group_sysargs 
(test.test_argparse.TestPositionalsNargsZeroOrMoreNone)
--
Traceback (most recent call last):
  File /home/wolf/dev/py/3.3/Lib/test/test_argparse.py, line 216, in wrapper
test_func(self)
  File /home/wolf/dev/py/3.3/Lib/test/test_argparse.py, line 236, in 
test_failures
parser.parse_args(args)
AssertionError: ArgumentParserError not raised : ['foo', 'bar']

--
keywords: +patch
nosy: +ezio.melotti
stage:  - patch review
versions: +Python 3.4
Added file: http://bugs.python.org/file29280/issue11955.diff

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



[issue14468] Update cloning guidelines in devguide

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

Yes, it should be added back in the FAQs.

--

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



[issue17324] SimpleHTTPServer serves files even if the URL has a trailing slash

2013-03-01 Thread Larry Hastings

New submission from Larry Hastings:

To reproduce:

1) Create a file called foo.txt in the local directory, put whatever you like 
in it.
2) Run python -m SimpleHTTPServer or python3 -m http.server.
3) Point your web browser at http://127.0.0.1:8000/foo.txt/;.
4) Note that the server has served the contents of foo.txt as foo.txt/.  It 
shouldn't do that!

Reproduced with 2.7.3, 3.2.3, and 3.3.0.  I assume it's still there in trunk.

--
components: Library (Lib)
keywords: easy
messages: 183247
nosy: larry
priority: low
severity: normal
status: open
title: SimpleHTTPServer serves files even if the URL has a trailing slash
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue17324] SimpleHTTPServer serves files even if the URL has a trailing slash

2013-03-01 Thread Larry Hastings

Changes by Larry Hastings la...@hastings.org:


--
stage:  - test needed
type:  - behavior

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



[issue17079] Fix test discovery for test_ctypes.py

2013-03-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 42d4a29509c4 by Ezio Melotti in branch '3.3':
#17079: test_ctypes now works with unittest test discovery.  Patch by Zachary 
Ware.
http://hg.python.org/cpython/rev/42d4a29509c4

New changeset e222f24837dd by Ezio Melotti in branch 'default':
#17079: merge with 3.3.
http://hg.python.org/cpython/rev/e222f24837dd

--
nosy: +python-dev

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



[issue17079] Fix test discovery for test_ctypes.py

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!

--
assignee:  - ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue17082] Fix test discovery for test_dbm*.py

2013-03-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b62317fe1a22 by Ezio Melotti in branch '3.3':
#17082: test_dbm* now work with unittest test discovery.  Patch by Zachary Ware.
http://hg.python.org/cpython/rev/b62317fe1a22

New changeset e35c053cc4ec by Ezio Melotti in branch 'default':
#17082: merge with 3.3.
http://hg.python.org/cpython/rev/e35c053cc4ec

--
nosy: +python-dev

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



[issue17082] Fix test discovery for test_dbm*.py

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!
There are still two failures, but they will be addressed in #16935.

--
assignee:  - ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue17325] improve organization of the PyPI distutils docs

2013-03-01 Thread Chris Jerdonek

New submission from Chris Jerdonek:

This issue is to improve the organization of the PyPI section of the Distutils 
documentation, now that the information has been combined into one page.

A patch is attached.

Improvements include:

(1) Creating a section for command options common to both register and upload.  
Previously, this information was confined to the upload section, even though 
the information was applicable to both commands.
(2) Separating general information about PyPI (e.g. PyPI user permissions and 
the web interface) from the information about Distutils command usage.
(3) Consolidating information about the .pypirc file in the .pypirc section.  
Previously, some of the .pypirc information was spread throughout the upload 
section, even though the information is equally applicable to the register 
command.

--
assignee: eric.araujo
components: Distutils, Documentation
files: issue-pypi-docs.patch
keywords: patch
messages: 183252
nosy: chris.jerdonek, eric.araujo, tarek
priority: normal
severity: normal
stage: patch review
status: open
title: improve organization of the PyPI distutils docs
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29281/issue-pypi-docs.patch

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



[issue17323] Disable [X refs, Y blocks] ouput in debug builds

2013-03-01 Thread Chris Jerdonek

Chris Jerdonek added the comment:

The refs output also complicates testing in some cases, e.g.

http://hg.python.org/cpython/file/bc4458493024/Lib/test/test_subprocess.py#l61
http://hg.python.org/cpython/file/bc4458493024/Lib/test/test_subprocess.py#l786

--
nosy: +chris.jerdonek

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



[issue17288] cannot jump from a return after setting f_lineno

2013-03-01 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Nosying Benjamin Peterson who knows frame_setlineno (issue 14612) and nosying
Jesús Cea Avión. Hoping they don't mind.

This problem occurs also when setting f_lineno from an exception debug event.

One may crash the interpreter (or get a SystemError: unknown opcode) when the
return debug event is one that handles a yield statement.  For example the
following test causes a segmentation fault on python 3.3.0:

$ python /tmp/jump.py
 /tmp/jump.py(7)module()
- for i in gen():
(Pdb) step
--Call--
 /tmp/jump.py(1)gen()
- def gen():
(Pdb) step
 /tmp/jump.py(2)gen()
- for i in range(1):
(Pdb) step
 /tmp/jump.py(3)gen()
- yield i
(Pdb) step
--Return--
 /tmp/jump.py(3)gen()-0
- yield i
(Pdb) jump 2
 /tmp/jump.py(2)gen()-0
- for i in range(1):
(Pdb) step
 /tmp/jump.py(8)module()
- lineno = 8
(Pdb) step
 /tmp/jump.py(7)module()
- for i in gen():
(Pdb) step
--Call--
 /tmp/jump.py(2)gen()-0
- for i in range(1):
(Pdb) step
Segmentation fault

--
nosy: +benjamin.peterson, jcea
Added file: http://bugs.python.org/file29282/jump.py

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



[issue17288] cannot jump from a return after setting f_lineno

2013-03-01 Thread Xavier de Gaye

Xavier de Gaye added the comment:

The proposed patch fixes the problem:
* f_lineno cannot be set now from an exception trace function or from a return
  trace function.
* The broken arithmetic involving a null pointer (f-f_stacktop, at the end of
  frame_setlineno when popping blocks that are being jumped from and the
  function is invoked from an exception trace function or a return trace
  function), is fixed now.
* Blocks cannot be popped now in frame_setlineno (the cause of the crash) when
  tracing a yield.

To summarize the proposed fixes on f_lineno accessors:
* setter: f_lineno can only be set in the frame that is being traced (issue
  17277) and from within a line trace function (current issue).
* getter: f_lineno is valid in the frame being traced (issue 17277) and:
  + not from within a call trace function (i.e. when f-f_trace == NULL)
  + from within a line trace function
  + and from within an exception or return trace function. There is a corner
case here when returning to a frame that was not being traced previously
(its f_lineno is not valid) and that has had its local trace function
f_trace set from within a trace function in one of its callees (the fix of
issue 13183 does that) and when the first trace function invoked on
returning to that frame is an exception or a return trace function: this is
correctly handled by the f_trace setter that makes sure that f_lineno is
accurate when setting f_trace (and an extension module implementing tracing,
must ensure that f_lineno is accurate when setting f_trace).

--
keywords: +patch
Added file: http://bugs.python.org/file29283/default.patch

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



[issue16935] unittest should understand SkipTest at import time during test discovery

2013-03-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 61ce6deb4577 by Ezio Melotti in branch 'default':
#16935: unittest now counts the module as skipped if it raises SkipTest, 
instead of counting it as an error.  Patch by Zachary Ware.
http://hg.python.org/cpython/rev/61ce6deb4577

--
nosy: +python-dev

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



[issue16935] unittest should understand SkipTest at import time during test discovery

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

Applied, thanks for the patch!
SkipTest should probably be documented, but that's a separate issue :)

--
assignee: michael.foord - ezio.melotti
keywords:  -gsoc
resolution:  - fixed
stage: test needed - committed/rejected
status: open - closed

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



[issue16935] unittest should understand SkipTest at import time during test discovery

2013-03-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 22b6b59c70e6 by Ezio Melotti in branch 'default':
#16935: update test_crypt now that unittest discover understands SkipTest.
http://hg.python.org/cpython/rev/22b6b59c70e6

--

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



[issue17326] Windows build docs still referring to VS 2008 in 3.3

2013-03-01 Thread Christoph Zwerschke

New submission from Christoph Zwerschke:

The first paragraph in PCbuild/readme.txt of Python 3.3 still talks about 
Visual C++ 2008 Express and Visual Studio 2008. It says that VS 2008 is 
required at the very least (which may be still true, I'm not sure), but then it 
also says the official Python releases are built with this [i.e. the 2008] 
version of VS, while it seems they have been built with VS 2010 in reality (as 
the title is also indicating).

--
assignee: docs@python
components: Documentation
messages: 183259
nosy: cito, docs@python
priority: normal
severity: normal
status: open
title: Windows build docs still referring to VS 2008 in 3.3
type: enhancement
versions: Python 3.3

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



[issue17326] Windows build docs still referring to VS 2008 in 3.3

2013-03-01 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +brian.curtin

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-01 Thread Stefan Behnel

New submission from Stefan Behnel:

The functionality of dict.setdefault() is not currently available through the 
C-API. Specfically, there is no way to test for a key and insert a fallback 
value for it without evaluating the hash function twice.

The attached patch adds a new C-API function PyDict_GetItemSetDefault() that 
makes this feature available. Like all PyDict_Getitem*() functions, it returns 
a borrowed reference.

I hope I got the update in refcounts.dat right. I have no idea how to express 
that a function *may* increase the refcounts of its arguments.

--
components: Interpreter Core
files: pydict_setitemdefault.patch
keywords: patch
messages: 183260
nosy: scoder
priority: normal
severity: normal
status: open
title: Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file29284/pydict_setitemdefault.patch

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



[issue17328] Fix reference leak in dict_setdefault() in case of resize failure

2013-03-01 Thread Stefan Behnel

New submission from Stefan Behnel:

While writing the patch for issue 17327, I noticed that there is a double 
reference leak in dict_setdefault() under the rare condition that resizing 
fails. I'm not 100% sure that it's ok to move the increfs behind the resizing, 
but considering that the resizing code actually looks safe and shouldn't kill 
references that are currently in the dict, I don't think it can be a problem. 
And the caller should always own a reference to these two anyway. 
Alternatively, decrefing them if the failure occurs would be a less intrusive 
change.

--
components: Interpreter Core
files: dict_setdefault_refleak.patch
keywords: patch
messages: 183261
nosy: scoder
priority: normal
severity: normal
status: open
title: Fix reference leak in dict_setdefault() in case of resize failure
type: resource usage
versions: Python 2.6, Python 2.7, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29285/dict_setdefault_refleak.patch

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



[issue17329] Document unittest.SkipTest

2013-03-01 Thread Brett Cannon

New submission from Brett Cannon:

EOM

--
assignee: docs@python
components: Documentation
messages: 183262
nosy: brett.cannon, docs@python, ezio.melotti, michael.foord, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Document unittest.SkipTest
versions: Python 3.4

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



[issue17324] SimpleHTTPServer serves files even if the URL has a trailing slash

2013-03-01 Thread Senthil Kumaran

Senthil Kumaran added the comment:

I thought this was fixed (recently). Shall look again. Having the tests is the 
only hard part here.

--
nosy: +orsenthil

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



[issue17288] cannot jump from a return after setting f_lineno

2013-03-01 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +georg.brandl

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



[issue17288] cannot jump from a return after setting f_lineno

2013-03-01 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Must add for completeness that f_lineno must be valid within a return trace
function for the reasons explained in the last paragraph of
Objects/lnotab_notes.txt.

--

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



[issue15795] Zipfile.extractall does not preserve file permissions

2013-03-01 Thread Cédric de Saint Martin

Changes by Cédric de Saint Martin ced...@desaintmartin.fr:


--
nosy: +desaintmartin

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



[issue17298] Twisted test failure triggered by change in 2.7 branch

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

That buildbot seems to be green again: 
https://buildbot.twistedmatrix.com/builders/lucid32-py2.7maint/builds/2359/

Glyph, can you confirm that the problem has been fixed and that this issue can 
be closed?

--
nosy: +ezio.melotti
status: open - pending

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



[issue17315] test_posixpath doesn't clean up after itself

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

On Linux it looks OK.  Does it always happen?  Where is the file located?

--
nosy: +ezio.melotti

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



[issue17312] test_aifc doesn't clean up after itself

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

On Linux it looks OK.  Does it always happen?  Where is the file located?

--
nosy: +ezio.melotti

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



[issue17281] Broken links at pypi

2013-03-01 Thread Éric Araujo

Éric Araujo added the comment:

First link is broken because the distutils2 project in its current form is 
stopped and the doc is nowhere.  (Obsolete versions can be found in a few 
places :/)  Second link is broken due to Python wiki config changes.

I will update the PyPI metadata to explain the status of distutils2 and its 
successors.  Thanks for the report.

--
versions:  -Python 2.6, 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/issue17281
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17315] test_posixpath doesn't clean up after itself

2013-03-01 Thread Chris Jerdonek

Chris Jerdonek added the comment:

The file gets created in the current working directory.  You won't see it when 
using regrtest since regrtest creates and then deletes a temp working directory.

To see it easier, try running instead:

./python.exe -m unittest test.test_posixpath

--

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



[issue17330] Check st_nlink in addition to st_mtime to invalidate FileFinder cache

2013-03-01 Thread Erik Bray

New submission from Erik Bray:

This is vaguely related to issue14067, though the patch suggested there would 
make this problem worse, not better.

This addresses a problem that cropped up on OSX in which some code that, for 
Good Reasons, generates a module in a package directory and then expects to be 
able to import it.  Because HFS+ does not offer sub-second resolution for mtime 
the generated module is not found. We didn't have this problem on Linux or 
Windows.

I've attached one possible solution to the issue, which uses a tuple of 
st_mtime and st_nlink to determine if the cache should be invalidated.  This 
should pick up most file creation/deletion on such file systems even if the 
directory's mtime hasn't changed.  This doesn't add any additional system calls 
so it shouldn't have any significant performance impact.

In the meantime importlib.invalidate_caches() offers a consistent workaround, 
but it was surprising when this issue was found to be platform dependent.

--
components: None
hgrepos: 178
messages: 183270
nosy: erik.bray
priority: normal
severity: normal
status: open
title: Check st_nlink in addition to st_mtime to invalidate FileFinder cache
type: behavior
versions: Python 3.3

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



[issue17330] Check st_nlink in addition to st_mtime to invalidate FileFinder cache

2013-03-01 Thread Erik Bray

Changes by Erik Bray erik.m.b...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file29286/94e671589c0e.diff

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



[issue11448] docs for HTTPConnection.set_tunnel are ambiguous

2013-03-01 Thread Éric Araujo

Éric Araujo added the comment:

 This is a possible additional example for set_tunnel,
Thanks.  In general, our tooling expects unified diffs, such as produced by hg 
diff.

 modification of python3.3/html/_sources/library/http.client.txt
That’s a copy for web hosting, the real source is in 
Doc/library/http.client.rst (see devguide for more info).

--
nosy: +eric.araujo

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



[issue17306] Improve the way abstract base classes are shown in help()

2013-03-01 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo
versions: +Python 3.4 -Python 2.7

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



[issue17312] test_aifc doesn't clean up after itself

2013-03-01 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Similar to as I stated in issue 17315, you won't see it when using regrtest 
since regrtest creates and then deletes a temp working directory.

The file gets created and is left behind in the current working directory.  Try 
running using unittest, e.g.

./python.exe -m unittest 
test.test_aifc.AIFCLowLevelTest.test_write_aiff_by_extension

--

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



[issue17330] Check st_nlink in addition to st_mtime to invalidate FileFinder cache

2013-03-01 Thread Brett Cannon

Brett Cannon added the comment:

[for anyone else who doesn't know what st_nlink is for: 
http://docs.python.org/3/library/stat.html#stat.ST_NLINK]

Since it doesn't add stat overhead as it's just part of what os.path.stats() 
returns I'm fine with adding it to part of the invalidation scheme. What do you 
think, Antoine?

--
nosy: +brett.cannon, pitrou

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



[issue17315] test_posixpath doesn't clean up after itself

2013-03-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ed3ca7298055 by Ezio Melotti in branch '2.7':
#17315: unlink a file that test_posixpath was leaving around.
http://hg.python.org/cpython/rev/ed3ca7298055

New changeset c65e98ce1a05 by Ezio Melotti in branch '3.2':
#17315: unlink a file that test_posixpath was leaving around.
http://hg.python.org/cpython/rev/c65e98ce1a05

New changeset 7a2169a80f48 by Ezio Melotti in branch '3.3':
#17315: merge with 3.2.
http://hg.python.org/cpython/rev/7a2169a80f48

New changeset 7234370fc556 by Ezio Melotti in branch 'default':
#17315: merge with 3.3.
http://hg.python.org/cpython/rev/7234370fc556

--
nosy: +python-dev

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



[issue17315] test_posixpath doesn't clean up after itself

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

Should be fixed now.

--
assignee:  - ezio.melotti
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
versions: +Python 2.7, Python 3.2, Python 3.3

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



[issue17330] Check st_nlink in addition to st_mtime to invalidate FileFinder cache

2013-03-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Well, importlib.invalidate_caches() is not a workaround, it's really the right 
way to solve your issue (for example if instead of writing a new module, you 
modify an existing one: st_nlink will then remain the same).

--

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



[issue17312] test_aifc doesn't clean up after itself

2013-03-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 10909360a11d by Ezio Melotti in branch 'default':
#17312: unlink a file that test_aifc was leaving around.
http://hg.python.org/cpython/rev/10909360a11d

--
nosy: +python-dev

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



[issue17312] test_aifc doesn't clean up after itself

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

Should be fixed now.

--
assignee:  - ezio.melotti
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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




[issue17312] test_aifc doesn't clean up after itself

2013-03-01 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Thanks.

--

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



[issue17315] test_posixpath doesn't clean up after itself

2013-03-01 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Thanks, I confirmed the fix.

--

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



[issue17328] Fix reference leak in dict_setdefault() in case of resize failure

2013-03-01 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +serhiy.storchaka
stage:  - patch review

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



[issue17330] Check st_nlink in addition to st_mtime to invalidate FileFinder cache

2013-03-01 Thread Brett Cannon

Brett Cannon added the comment:

Antoine does make a good point: adding st_nlink could lead to some 
hard-to-discover bugs because something will work the first time when the file 
is added but then subsequently fail if you are modifying the new file in-place.

I'm going to go with Antoine's thinking and close this bug as won't fix. 
Thanks for at least taking a stab at the code, Erik.

--
resolution:  - wont fix
status: open - closed

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



[issue17298] Twisted test failure triggered by change in 2.7 branch

2013-03-01 Thread Glyph Lefkowitz

Glyph Lefkowitz added the comment:

Confirmed.  Thanks very much for addressing it promptly.

--
resolution:  - duplicate
status: pending - closed

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



[issue17298] Twisted test failure triggered by change in 2.7 branch

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

Thank you for finding and reporting it!

--
stage: needs patch - committed/rejected

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



[issue17330] Check st_nlink in addition to st_mtime to invalidate FileFinder cache

2013-03-01 Thread Erik Bray

Erik Bray added the comment:

Why should modifying the file in place be expected to do anything with respect 
to the directory cache?  If that module has already been imported then 
modifying it should not require the cache to be invalidated.

If the file is modified *before* it's imported that's still irrelevant because 
that means the file exists in the directory and will be included in the cache 
when it gets generated.

Relying on invalidate_caches() is a workaround because it's not even necessary 
on better filesystems--the existing behavior already leads to hard to find bugs.

--

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



[issue17330] Check st_nlink in addition to st_mtime to invalidate FileFinder cache

2013-03-01 Thread Erik Bray

Erik Bray added the comment:

Put another way, the cache associated with a FileFinder only keeps track of the 
filenames in a directory, and not their individual mtimes.  So if a new file is 
added to the directory the cache should be invalided.  Likewise if a file is 
removed.

If a file is modified or removed and a new file with the same name subsequently 
added this is irrelevant to the cache.  Importing that module will still 
succeed if it hasn't already been imported.  If that module's file is *not* in 
the cache then an ImportError is raised.

--

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



[issue17330] Check st_nlink in addition to st_mtime to invalidate FileFinder cache

2013-03-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Put another way, the cache associated with a FileFinder only keeps
 track of the filenames in a directory, and not their individual
 mtimes.  So if a new file is added to the directory the cache should
 be invalided.  Likewise if a file is removed.

True, but if a file is removed and another added, st_nlink won't change.
Which will lead to even harder to find bugs.

I agree it would be better if it were always possible to detect
directory modifications, without any false negatives. Sadly it is not
(blame POSIX, I guess, although Windows is not better here), hence
invalidate_caches().

--

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



[issue17330] Check st_nlink in addition to st_mtime to invalidate FileFinder cache

2013-03-01 Thread Erik Bray

Erik Bray added the comment:

Fair enough, but then I would propose removing the automatic cache invalidation 
based on mtime altogether.  It's just not reliable enough--this caused 
previously working code to break unexpectedly, and only on a single platform at 
that.

I'm fine with importlib.invalidate_caches() being the correct solution--but 
then that should be consistent and enforced, and not just something you may 
have to do sometimes in some cases but that you don't really need in other 
cases.

--

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



[issue17330] Check st_nlink in addition to st_mtime to invalidate FileFinder cache

2013-03-01 Thread Erik Bray

Erik Bray added the comment:

I should add, Antoine's counter-example of a file that's renamed or replaced 
already doesn't work either under OSX.  So while this solution won't address 
that (even more narrow) use case, it would at least improve the existing 
situation for what I would like to think is a much more common use case.

--

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



[issue16997] subtests

2013-03-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 That means there's a part of Antoine's patch I disagree with: the
 change to eliminate the derived overall result attached to the
 aggregate test.

The patch doesn't eliminate it, there are even tests for it.
(see the various call order tests)

 The complexity involved in attempting to get expectedFailure() to
 behave as expected is also a strong indication that there are still
 problems with the way these results are being aggregated.

No, the complexity stems from the fact that the expectedFailure decorator knows 
nothing about the test running machinery and instead blindly raises an 
exception.

--

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



[issue17330] Check st_nlink in addition to st_mtime to invalidate FileFinder cache

2013-03-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I should add, Antoine's counter-example of a file that's renamed or
 replaced already doesn't work either under OSX.  So while this
 solution won't address that (even more narrow) use case, it would at
 least improve the existing situation for what I would like to think is
 a much more common use case.

Yes, it seems all possibilities have mixed outcomes. I'll let Brett
decide :-)

--

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



[issue17331] Fix str methods for detecting digits with unicode

2013-03-01 Thread Mathieu Pasquet

New submission from Mathieu Pasquet:

In py3k, str.isalnum(), str.isdigit(), and str.isdecimal() are broken because 
they take into account various unicode numbers.

A common case is doing something like that:

num = -1
while num == -1:
num_in = input('Enter a number ')
if num_in.isdigit():
num = int(num_in)

# do stuff …

If you enter ¹, or any esoteric unicode representation of a number, all the 
methods referenced above will return True. I believe this is a bug.

It also affects the stdlib, e.g. in collection.namedtuple,
A = namedtuple('A¹', 'x y') will return an ugly Syntax Error, because the 
sanity check uses str.isalnum(), which says it’s ok. (n.b.: of course, no sane 
person should ever want to do the above, but I find it worth mentionning)

--
components: Unicode
messages: 183291
nosy: ezio.melotti, mathieui
priority: normal
severity: normal
status: open
title: Fix str methods for detecting digits with unicode
type: behavior
versions: Python 3.3

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



[issue17301] An in-place version of many bytearray methods is needed

2013-03-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I think you need to make more of a case for 'should'. Bytearrays are, well, 
byte arrays, not text arrays. I could just as well claim that the ascii text 
operations should not even be there. They are certainly not needed for typical 
mixed binary-ascii protocol strings, which is what bytearrars were intended 
for. In any case, this would fatten the api considerably for not too much 
benefit. I think that this, like many or most enhancement proposals, should 
best be discussed on python-ideas list before any tracker action.

I consider translate an exception to the above comments. It is a byte 
operation, not a text operations. bytearry.translate could plausibly have been 
defined as 'in-place' when added. Most of the other operations are special 
cases of translate, and can therefore be done with translate, without the 
limitation to only ascii chars. If one wants to directly uppercase latin-1 
encoded bytes without decoding to text, one would need .translate anyway.

--
components: +Library (Lib) -Interpreter Core
nosy: +terry.reedy

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



[issue17302] HTTP/2.0 - Implementations/Testing efforts

2013-03-01 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
resolution:  - postponed
status: open - closed

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



[issue17332] typo in json docs - convered should be converted

2013-03-01 Thread Ernie Hershey

New submission from Ernie Hershey:

Hi,

On these pages:

http://docs.python.org/3.4/library/json.html
http://docs.python.org/3.3/library/json.html
http://docs.python.org/3.2/library/json.html
http://docs.python.org/2/library/json.html
http://docs.python.org/2.6/library/json.html

This line says convered but should be converted.

Note Keys in key/value pairs of JSON are always of the type str. When a 
dictionary is converted into JSON, all the keys of the dictionary are coerced 
to strings. As a result of this, if a dictionary is convered into JSON and then 
back into a dictionary, the dictionary may not equal the original one. That is, 
loads(dumps(x)) != x if x has non-string keys.

--
assignee: docs@python
components: Documentation
messages: 183293
nosy: docs@python, ernest
priority: normal
severity: normal
status: open
title: typo in json docs - convered should be converted
type: enhancement
versions: Python 2.6, 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/issue17332
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17333] Fix test discovery for test_imaplib.py

2013-03-01 Thread Zachary Ware

New submission from Zachary Ware:

Here's a patch for test_imaplib.py that converts test_main into load_tests.

--
components: Tests
files: test_imaplib_discovery.diff
keywords: patch
messages: 183294
nosy: brett.cannon, ezio.melotti, zach.ware
priority: normal
severity: normal
status: open
title: Fix test discovery for test_imaplib.py
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29287/test_imaplib_discovery.diff

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



[issue17331] Fix str methods for detecting digits with unicode

2013-03-01 Thread R. David Murray

R. David Murray added the comment:

I think this is working as designed, and can't be changed (at least not easily) 
because of backward compatibility even if there are bits of the design that are 
deemed buggy.  The issue, I believe, is what is considered a number by the 
Unicode consortium.

See issue 10557 for some background.

Python should at least be consistent about what is treated as a number, though, 
so the ugly syntax error from namedtuple is probably a bug.

--
nosy: +eric.smith, lemburg, mark.dickinson, r.david.murray, rhettinger

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



[issue17331] Fix str methods for detecting digits with unicode

2013-03-01 Thread Florent Xicluna

Florent Xicluna added the comment:

Actually, the character is SUPERSCRIPT ONE, in the category No (Number other).
http://www.fileformat.info/info/unicode/char/b9/index.htm

This is not a valid category for the identifiers, only Nd Number decimal is 
accepted.

The issue is probably in namedtuple, which should check the 
unicodedata.category or better, check with method str.isidentifier.

--
nosy: +flox
versions: +Python 3.2

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



[issue17330] Stop checking for directory cache invalidation in importlib

2013-03-01 Thread Brett Cannon

Brett Cannon added the comment:

So let's see what options we have on the table.

Status quo: picks up mutated modules as long as the mtime is granular enough. 
Fails in the face of added fails under the same conditions. Need to call 
importlib.invalidate_caches() to avoid this problem.

Add st_nlinks: Would help in the situation of an added/removed file. Doesn't 
fix mtime granularity problem. Still might need to call 
importlib.invalidate_caches() if doing more than adding files.

Drop implicit cache validation entirely: Force people to call 
importlib.invalidate_caches() no matter what (so no more accidental it worked 
on my machine but not that other one). Cuts down on stat call overhead by 1 
per file-based import (which benchmarking suggests doesn't get us anything).

I'm leaning towards just dropping the implicit cache invalidation and forcing 
people to call importlib.invalidate_caches() when they muck with the underlying 
modules on sys.path/__path__. This probably would have helped when we started 
to run into similar problems in the stdlib's test suite when this whole caching 
mechanism was added. Since this lowers the chance of mistakenly thinking code 
will work when deployed on other filesystems and speed things up in the 
majority of cases where people are not dynamically generating files in sys.path.

I don't know if backporting is a good idea, though, as it might catch people by 
surprise who are not trying to run on different filesystems in 3.3.1. Then 
again, being lucky in not needing to call importlib.invalidate_caches() doesn't 
mean that starting to call it properly is a bad thing in a bugfix release.

Re-opening the bug under a different name while we think about this.

--
components: +Interpreter Core -None
resolution: wont fix - 
stage:  - needs patch
status: closed - open
title: Check st_nlink in addition to st_mtime to invalidate FileFinder cache - 
Stop checking for directory cache invalidation in importlib
versions: +Python 3.4 -Python 3.3
Added file: 
http://bugs.python.org/file29288/drop_implicit_cache_invalidation.diff

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



[issue17331] Fix str methods for detecting digits with unicode

2013-03-01 Thread Mathieu Pasquet

Mathieu Pasquet added the comment:

I understand the reasoning behind the feature, and the will to be 
unicode-compliant, but I think this might still break a lot of code (though it 
may never be detected).

I understand that isdecimal() is the safe way, because anything that is a 
decimal (Nd) can be translated to an integer by int() ; however, what is the 
recommended way to get something that isnumeric() into an int?

unicodedata.normalize('NFKD', num) or unicodedata.normalize('NFKC', num)?

Maybe str could have a method that does this, or methods performing exclusively 
on ascii values?

Sorry for the noise, I did not find issue 10557 when I searched.

--

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



[issue17334] Fix test discovery for test_index.py

2013-03-01 Thread Zachary Ware

New submission from Zachary Ware:

Just subclassing issues in this one.

--
components: Tests
files: test_index_discovery.diff
keywords: patch
messages: 183299
nosy: brett.cannon, ezio.melotti, zach.ware
priority: normal
severity: normal
status: open
title: Fix test discovery for test_index.py
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29289/test_index_discovery.diff

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



[issue17309] __bytes__ doesn't work in subclass of int and str

2013-03-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The library doc says that if the source argument for bytes() or bytearray() is 
a string or integer it is treated a certain way. I believe 'string' and 
'integer' are meant to include subclasses of str and int, else it should have 
said str or int. You have verified that int subclass instances are indeed 
treated as integers. The following shows that str subclass instances are 
treated as strings.

class mystr(str):
def __bytes__(self): return b'hello'
print(bytes(mystr('a')))
raises TypeError: string argument without an encoding

The language reference says object.__bytes__(self): Called by bytes() to 
compute a byte-string representation of an object. No exception is given. I 
see this as a contradiction in the manual, in which case the current behavior 
rules and the contradiction is removed by changing the doc part that conflicts 
with behavior. That would mean extending the doc sentence with 'that is not a 
string or integer'.

However, I am waiting for other opinions for two reasons.

1. The doc also specified special treatment for buffer interface and iterable 
objects. However, __bytes__ *is* checked first for those objects. 

class myit(list):
def __bytes__(self): return b'hello'
print (bytes (myit([1,2,3])))
# b'hello'

class mybit(bytes):  # example 
def __bytes__(self): return b'hello'
print (bytes (mybit(b'a')))
# b'hello'

So the exception is limited to 'strings' and 'integers', making it somewhat 
inconsistent.

2. If someone gives an str or int subclass a __bytes__ method, they can only 
mean for it to be called by bytes(), as there is no other use of that special 
method.

On the third hand, a user of a class who tests its instances before calling 
bytes with isinstance(x, (str, int)) instead of type(x) is str or type(x) is 
int, likely expects getting normal string or integer behavior. Of course, the 
same might be true if the test is 'isiterable(x)'.

If behavior were changed, I think it should wait for 3.4 since the current 
behavior is not clearly a bug to me.

--
assignee:  - docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python, terry.reedy
title: __bytes__ doesn't work in subclass of int - __bytes__ doesn't work in 
subclass of int and str
versions: +Python 2.7, Python 3.3, Python 3.4

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



[issue17285] subprocess.check_output incorrectly state that output is always bytes

2013-03-01 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +terry.reedy
versions: +Python 3.4 -Python 3.1

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



[issue17309] __bytes__ doesn't work in subclass of int and str

2013-03-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

More data:

class myit(list):
def __bytes__(self): return b'hello'
print (bytes(b'a'))

class myit(list):
def __bytes__(self): return b'hello'
print (bytearray (myit([1,2,3])))

# bytearray(b'a')
# bytearray(b'\x01\x02\x03')

class by:
def __bytes__(self): return b'hello'
# TypeError: 'by' object is not iterable
(Error message is incomplete.)

So bytearray *always* treats objects as specified in its library entry and 
never calls __bytes__, making its value sometimes unequal as a sequence of 
bytes from bytes with the same input.

--

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



[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2013-03-01 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +amaury.forgeotdarc, meador.inge

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



[issue17301] An in-place version of many bytearray methods is needed

2013-03-01 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Translate isn't a text operation. (That's the api I wanted).  The others I
only lists for completeness because someone else would complain if I
hadn't. ;)
On Mar 1, 2013 12:57 PM, Terry J. Reedy rep...@bugs.python.org wrote:


 Terry J. Reedy added the comment:

 I think you need to make more of a case for 'should'. Bytearrays are,
 well, byte arrays, not text arrays. I could just as well claim that the
 ascii text operations should not even be there. They are certainly not
 needed for typical mixed binary-ascii protocol strings, which is what
 bytearrars were intended for. In any case, this would fatten the api
 considerably for not too much benefit. I think that this, like many or most
 enhancement proposals, should best be discussed on python-ideas list before
 any tracker action.

 I consider translate an exception to the above comments. It is a byte
 operation, not a text operations. bytearry.translate could plausibly have
 been defined as 'in-place' when added. Most of the other operations are
 special cases of translate, and can therefore be done with translate,
 without the limitation to only ascii chars. If one wants to directly
 uppercase latin-1 encoded bytes without decoding to text, one would need
 .translate anyway.

 --
 components: +Library (Lib) -Interpreter Core
 nosy: +terry.reedy

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue17301
 ___


--

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



[issue17331] namedtuple raises a SyntaxError instead of ValueError on invalid identifier

2013-03-01 Thread Florent Xicluna

Florent Xicluna added the comment:

This is consistent:

 '¹'.isnumeric(), '¹'.isdigit(), '¹'.isdecimal()
(True, True, False)

 unicodedata.numeric('¹')
1.0
 unicodedata.digit('¹')
1
 unicodedata.decimal('¹')
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: not a decimal
 

Changing the title to focus on the issue with collections.namedtuple.

--
components: +Library (Lib)
title: Fix str methods for detecting digits with unicode - namedtuple raises a 
SyntaxError instead of ValueError on invalid identifier
versions: +Python 3.4

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



[issue10716] Modernize pydoc to use better HTML and separate CSS

2013-03-01 Thread Ron Adam

Ron Adam added the comment:

I'm going to go over this issue again with fresh eyes after having been away 
for some time.

Recent experience with another project has helped answer some of the questions 
I had earlier.  Particulary, how not to over specifying class names and id's.  
This should lead to cleaner html pages that will be easier to style with css.  
It should also lead to a smaller patch. ;-)

It seems that most of the input so far has more to do with spelling rather than 
function.  Is there a prefered style guide for css that we should use?

--

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



[issue17330] Stop checking for directory cache invalidation in importlib

2013-03-01 Thread Eric Snow

Eric Snow added the comment:

Yanking the implicit cache validation does seem to be the simplest solution 
here.  Perhaps we could come up with a complex way of making this work, but I 
don't think it's worth it.

What may be worth it is making the admonition of use invalidate_caches() 
easier to find.  I imagine the situation like this:

1. dynamically generate module
2. try to import it and get ImportError
3. scratch head and make sure it's actually valid code, reboot, etc.
4. still not working
5. search google or Python docs for an answer

and step 5 isn't working out well enough.  Removing the implicit cache 
invalidation would only make a more reliable step 5 even more important.

How to make that happen?  I'm not sure.  Perhaps a dedicated Trouble-shooting 
Imports FAQ with a links to it on relevant pages like importlib, imp, and the 
import statement.  Maybe we already have something like that and I've just 
missed it.

--
nosy: +eric.snow

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



[issue17331] namedtuple raises a SyntaxError instead of ValueError on invalid identifier

2013-03-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

namedtuple should simply use isidentifier(), rather than isalnum().

--
nosy: +pitrou

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



[issue17330] Stop checking for directory cache invalidation in importlib

2013-03-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I would suggest checking on python-dev before removing the cache
freshness check. Some people may rely on it.

--

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



[issue17335] FieldStorageClass is messed up

2013-03-01 Thread Neal Norwitz

New submission from Neal Norwitz:

This problem goes back to 2.6 at least.

In Lib/cgi.py

FieldStorageClass = None

def read_multi(self, environ, keep_blank_values, strict_parsing):
Internal: read a part that is itself multipart.
ib = self.innerboundary
if not valid_boundary(ib):
raise ValueError, 'Invalid boundary in multipart form: %r' % (ib,)
self.list = []
if self.qs_on_post:
for key, value in urlparse.parse_qsl(self.qs_on_post,
self.keep_blank_values, self.strict_parsing):
self.list.append(MiniFieldStorage(key, value))
FieldStorageClass = None

The set of FieldStorageClass is to a local variable, so a no-op since it's 
never read.  The class attribute will always be None unless set outside this 
class (not sure if it is).  It looks like it should just be removed.

--
messages: 183308
nosy: Neal.Norwitz
priority: normal
severity: normal
status: open
title: FieldStorageClass is messed up
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue17330] Stop checking for directory cache invalidation in importlib

2013-03-01 Thread Erik Bray

Erik Bray added the comment:

Dropping the implicit invalidation altogether works for me.  I was hoping to 
find a better solution because for the majority of use cases I personally care 
about the existing behavior is preferable.

That said I have to support OSX users as possibly the majority of my userbase, 
and I think that for anyone it's a big enough exception that it can't be 
ignored.

That being the case, explicit is better than implicit here.  I didn't have too 
much trouble finding importlib.invalidate_caches() once I realized what the 
problem was, but the fact that this change needs to be made could be better 
advertised I suppose.

Thanks.

--

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



[issue17331] namedtuple raises a SyntaxError instead of ValueError on invalid identifier

2013-03-01 Thread Ramchandra Apte

Ramchandra Apte added the comment:

 namedtuple should simply use isidentifier(), rather than isalnum().
+2

--
nosy: +Ramchandra Apte

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



[issue17331] namedtuple raises a SyntaxError instead of ValueError on invalid identifier

2013-03-01 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee:  - rhettinger
priority: normal - high

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



[issue17331] namedtuple raises a SyntaxError instead of ValueError on invalid identifier

2013-03-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 80bcc98bf939 by Raymond Hettinger in branch '3.3':
Issue #17331:  Use isidentifier() instead of isalnum() to check for valid 
identifiers.
http://hg.python.org/cpython/rev/80bcc98bf939

--
nosy: +python-dev

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