[issue22065] Update turtledemo menu creation

2014-08-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

# 3 on my list of patches to review and apply

--

___
Python tracker 

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



[issue22191] warnings.__all__ incomplete

2014-08-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue20689. socket.__all__ is incomplete too.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue22193] Add _PySys_GetSizeOf()

2014-08-14 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch adds private function _PySys_GetSizeOf(). It is needed for 
correct implementing of __sizeof__() methods: issue15490, issue15513, 
issue15381 (BytesIO.__sizeof__ is broken in 3.5). See discussion about it in 
issue15490. I extracted this patch in separate issue for its simplicity and 
because it is needed in other issues.

--
assignee: serhiy.storchaka
components: Interpreter Core
files: _PySys_GetSizeOf.patch
keywords: patch
messages: 225294
nosy: loewis, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Add _PySys_GetSizeOf()
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36368/_PySys_GetSizeOf.patch

___
Python tracker 

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



[issue15381] Optimize BytesIO to do less reallocations when written, similarly to StringIO

2014-08-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch which optimizes readline() and readlines() methods of BytesIO 
and the __next__() method of BytesIO iterator.

--
Added file: http://bugs.python.org/file36369/bytesio_faster_readline.patch

___
Python tracker 

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



[issue22191] warnings.__all__ incomplete

2014-08-14 Thread Jon Poler

Jon Poler added the comment:

Serhiy, should I submit these fixes as separate patches? E.g. one patch for the 
warnings module, and another for the socket module?

More generally, should the items included in __all__ be derived from the items 
described in the documentation? For instance, only the functions listed in 
18.1.2 https://docs.python.org/dev/library/socket.html#module-contents ?

And finally, should a unittest be added for both of these modules to ensure 
that __all__ includes all of the desired publicly exposed elements?

--

___
Python tracker 

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



[issue22194] access to cdecimal / libmpdec API

2014-08-14 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Currently cdecimal exports no C API that I know of, and it makes sure the 
libmpdec symbols are kept private in the .so file. It would be nice for 
external C code (or, in general, non-Python code) to be able to access cdecimal 
objects, and make operations on them, without the huge overhead of the regular 
C Python API.

--
messages: 225297
nosy: pitrou, skrah
priority: normal
severity: normal
status: open
title: access to cdecimal / libmpdec API
type: enhancement

___
Python tracker 

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



[issue15381] Optimize BytesIO to do less reallocations when written, similarly to StringIO

2014-08-14 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I suppose this takes advantage of the libc's optimized memchr(). Any benchmarks?
(patch looks fine, by the way)

--

___
Python tracker 

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



[issue22191] warnings.__all__ incomplete

2014-08-14 Thread Brett Cannon

Brett Cannon added the comment:

Yes, please use separate patches attached to the appropriate bug. As for what 
should go into __all__, it's what is documented as the API of the module. As 
for tests, it doesn't hurt. =)

--

___
Python tracker 

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



[issue21795] smtpd.SMTPServer should announce 8BITMIME when supported and accept SMTPUTF8 without it

2014-08-14 Thread R. David Murray

R. David Murray added the comment:

Added some review comments.

--

___
Python tracker 

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



[issue22193] Add _PySys_GetSizeOf()

2014-08-14 Thread Martin v . Löwis

Martin v. Löwis added the comment:

LGTM

--
stage: patch review -> commit review

___
Python tracker 

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



[issue22195] Make it easy to replace print() calls with logging calls

2014-08-14 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Often an application (or e.g. a library's test suite), in its early 
development, will start making print() calls, and later will want to switch to 
the logging module. However the logging module doesn't offer any facility for 
this: you can't print() to a logger object, and loggers don't have a method 
that reflects print()'s signature.

(note print() only uses the .write() and .flush() methods on its stream 
argument, so a simple wrapper may make the trick)

--
components: Library (Lib)
messages: 225302
nosy: pitrou, vinay.sajip
priority: normal
severity: normal
status: open
title: Make it easy to replace print() calls with logging calls
type: enhancement
versions: Python 3.5

___
Python tracker 

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



[issue22196] namedtuple documentation could/should mention the new Enum type

2014-08-14 Thread Lele Gaifax

New submission from Lele Gaifax:

The documentation of namedtuple, near the end, talks about implementing 
enumerated constants and says “Enumerated constants can be implemented with 
named tuples, but it is simpler and more efficient to use a simple class 
declaration“.

Maybe it should mention the recently added Enum type instead/too.

--
assignee: docs@python
components: Documentation
messages: 225303
nosy: docs@python, lelit
priority: normal
severity: normal
status: open
title: namedtuple documentation could/should mention the new Enum type

___
Python tracker 

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



[issue22195] Make it easy to replace print() calls with logging calls

2014-08-14 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy: +BreamoreBoy

___
Python tracker 

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



[issue22197] Allow better verbosity / output control in test cases

2014-08-14 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Currently, test cases have no control over output and verbosity. I would 
propose two possible enhancements:
- give the TestCase read access to the verbosity value (as e.g. 
`self.verbosity`), to allow for conditional output in tests
- allow test methods to force output buffering (rather than only let the user 
specify it on the command line), because you would like some stuff to only be 
printed out on failure; a decorator would IMO be fine

--
components: Library (Lib)
messages: 225304
nosy: ezio.melotti, michael.foord, pitrou
priority: normal
severity: normal
status: open
title: Allow better verbosity / output control in test cases
type: enhancement
versions: Python 3.5

___
Python tracker 

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



[issue22197] Allow better verbosity / output control in test cases

2014-08-14 Thread Zachary Ware

Changes by Zachary Ware :


--
nosy: +zach.ware

___
Python tracker 

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



[issue22195] Make it easy to replace print() calls with logging calls

2014-08-14 Thread Saimadhav Heblikar

Changes by Saimadhav Heblikar :


--
nosy: +sahutd

___
Python tracker 

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



[issue22198] Odd floor-division corner case

2014-08-14 Thread Mark Dickinson

New submission from Mark Dickinson:

I'm not sure it's worth fixing this, but it seems worth recording:

>>> -0.5 // float('inf')
-1.0

I was expecting a value of `-0.0`, and while IEEE 754 doesn't cover the floor 
division operation, I'm reasonably confident that that's the value it would 
have recommended if it had. :-)

However, it's difficult to come up with a situation where the difference 
matters: there aren't any obvious invariants I can think of that are broken by 
this special case.  So unless anyone thinks it should be changed, I'll settle 
for recording the oddity in this issue, and closing as won't fix after a short 
period.

--
assignee: mark.dickinson
components: Interpreter Core
messages: 225305
nosy: mark.dickinson
priority: normal
severity: normal
status: open
title: Odd floor-division corner case
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5

___
Python tracker 

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



[issue22198] Odd floor-division corner case

2014-08-14 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +skrah

___
Python tracker 

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



[issue22198] Odd floor-division corner case

2014-08-14 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +tim.peters

___
Python tracker 

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



[issue15381] Optimize BytesIO to do less reallocations when written, similarly to StringIO

2014-08-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Benchmark from issue22003:

$ ./python0 -m timeit -s 'import i' 'i.readlines()'

Before patch: 10 loops, best of 3: 36.1 msec per loop
After patch: 10 loops, best of 3: 27.5 msec per loop

--

___
Python tracker 

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



[issue22199] Embedding Python documentation error

2014-08-14 Thread Jim Carroll

New submission from Jim Carroll:

On the page 
https://docs.python.org/2/extending/embedding.html#compiling-and-linking-under-unix-like-systems

The documentation makes the following reference:

"...(use sysconfig.get_makefile_filename() to find its location)..."

But this is incorrect. sysconfig was modified in 3.x (Issue 9877) to use this 
new name. In 2.x, the function has an underscore prefix:

sysconfig._get_makefile_filename()

--
assignee: docs@python
components: Documentation
messages: 225307
nosy: docs@python, jamercee
priority: normal
severity: normal
status: open
title: Embedding Python documentation error
versions: Python 2.7

___
Python tracker 

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



[issue21795] smtpd.SMTPServer should announce 8BITMIME when supported and accept SMTPUTF8 without it

2014-08-14 Thread Milan Oberkirch

Milan Oberkirch added the comment:

Thanks, for the review, here's comes an updated version.

--
Added file: http://bugs.python.org/file36370/issue21795v2.patch

___
Python tracker 

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



[issue22198] Odd floor-division corner case

2014-08-14 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On Thu, Aug 14, 2014 at 04:47:41PM +, Mark Dickinson wrote:

> I'm not sure it's worth fixing this, but it seems worth recording:
> 
> >>> -0.5 // float('inf')
> -1.0
> 
> I was expecting a value of `-0.0`, and while IEEE 754 doesn't cover 
> the floor division operation, I'm reasonably confident that that's the 
> value it would have recommended if it had. :-)

Hmmm. I'm not so sure. -0.5 // something_really_big gives -1:

py> -0.5//1e200
-1.0

Consider something_really_big as it gets bigger and bigger and 
approaches infinity, if we *informally* take the limit -> inf I think it 
makes sense for it to return -1. Another way of looking at it is that 
-0.5/inf returns a negative infinitesimal quantity, and then taking the 
floor returns -1. So I think the current behaviour is "correct", for 
some definition of correct.

The alternative is a discontinuity, where -0.5//x = -1 for all finite 
but huge x and then suddenly 0 when x overflows to infinity. That's 
probably a bad idea.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue22193] Add _PySys_GetSizeOf()

2014-08-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b5114747d3ed by Serhiy Storchaka in branch '2.7':
Issue #22193: Added private function _PySys_GetSizeOf() needed to implement
http://hg.python.org/cpython/rev/b5114747d3ed

New changeset 46504edf7594 by Serhiy Storchaka in branch '3.4':
Issue #22193: Added private function _PySys_GetSizeOf() needed to implement
http://hg.python.org/cpython/rev/46504edf7594

New changeset e23999892e58 by Serhiy Storchaka in branch 'default':
Issue #22193: Added private function _PySys_GetSizeOf() needed to implement
http://hg.python.org/cpython/rev/e23999892e58

--
nosy: +python-dev

___
Python tracker 

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



[issue15381] Optimize BytesIO to do less reallocations when written, similarly to StringIO

2014-08-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 601045ceff94 by Serhiy Storchaka in branch 'default':
Issue #15381: Optimized line reading in io.BytesIO.
http://hg.python.org/cpython/rev/601045ceff94

--

___
Python tracker 

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



[issue22193] Add _PySys_GetSizeOf()

2014-08-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Martin.

--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

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



[issue22198] Odd floor-division corner case

2014-08-14 Thread Tim Peters

Tim Peters added the comment:

I'm OK with -1, but I don't get that or -0.0 on 32-bit Windows Py 3.4.1:

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit 
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> -0.5 // float('inf')
nan

So maybe NaN is the best answer ;-)

In favor of -1.0:  that _is_ the limit of the mathematical floor(-0.5 / x) as x 
approaches +infinity.

In favor of -0.0:  it "should be" mathematically that floor_division(x/y) = 
floor(x / y), and floor(-0.5 / inf) = floor(-0.0) = ... well, not -0.0!  
floor() in Py3 is defined to return an integer, and there is no -0 integer:


>>> floor(-0.0)
0

That's +0.  So I see no justification at all for -0.0 in Py3.  -1 seems the 
best that can be done.  The NaN I actually get doesn't make sense.

--

___
Python tracker 

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



[issue22198] Odd floor-division corner case

2014-08-14 Thread Mark Dickinson

Mark Dickinson added the comment:

Steven: there's a set of (unwritten) rules for how the IEEE 754 operations 
work.  (I think they actually *were* articulated explicitly in some of the 754r 
drafts, but didn't make it into the final version.)  One of them is that 
ideally, a floating-point operations works as though the corresponding 
mathematical operation were performed exactly on the inputs (considered as real 
numbers), followed by a rounding step that takes the resulting real number and 
rounds it to the nearest floating-point number.  This is how essentially *all* 
the operations prescribed in IEEE 754 behave, with a greater or lesser amount 
of hand-waving when it comes to specifying results for special cases like 
infinities and nans.  In this case, the underlying mathematical operation is 
`x, y -> floor(x / y)`.  The only tricky point is the extension to infinity, 
but we've got the existing behaviour of regular division to guide us there - 
the result of dividing a finite value by an infinity is an appropriately signe
 d zero.  So there's really not a lot of room for manoeuvre in an IEEE 754-like 
operation.

> The alternative is a discontinuity, where -0.5//x = -1 for all finite 
> but huge x and then suddenly 0 when x overflows to infinity. That's 
> probably a bad idea.

Shrug: the underlying mathematical operation is discontinuous; I really don't 
see a problem here.  In any case, if you're worried about discontinuities, what 
about the one that occurs between positive values and negative values of x in 
the current implementation (a jump from 0 to -1)?  Continuity takes second 
place to correctness here.

--

___
Python tracker 

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



[issue22198] Odd floor-division corner case

2014-08-14 Thread Mark Dickinson

Mark Dickinson added the comment:

[Tim]
>>> -0.5 // float('inf')
nan

Urk!  I wonder what's going on there.  I think I like that answer even less 
than -1.0.

IEEE 754's floor does indeed take -0.0 to -0.0.

--

___
Python tracker 

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



[issue15381] Optimize BytesIO to do less reallocations when written, similarly to StringIO

2014-08-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch without just committed line reading optimization and committed in 
issue22193 the _PySys_GetSizeOf() function.

--
Added file: http://bugs.python.org/file36371/bytesio_resized_bytes-5.patch

___
Python tracker 

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



[issue15381] Optimize BytesIO to do less reallocations when written, similarly to StringIO

2014-08-14 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Can you post any benchmark?
Also, if you wouldn't change the resizing factor it would make it easier to 
compare the two approaches on their own merits, IMO.

--

___
Python tracker 

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



[issue15381] Optimize BytesIO to do less reallocations when written, similarly to StringIO

2014-08-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I posted benchmarks two years ago, in msg165795. Here are updated results:

$ ./python -m timeit -s "import io; n=100; d=[b'a'*n,b'bb'*n,b'ccc'*n]*1"  
"s=io.BytesIO(); w=s.write"  "for x in d: w(x)"  "s.getvalue()"

Before patch: 10 loops, best of 3: 42.3 msec per loop
After patch: 10 loops, best of 3: 27.6 msec per loop

$ ./python -m timeit -s "import io; n=1000; d=[b'a'*n,b'bb'*n,b'ccc'*n]*1000"  
"s=io.BytesIO(); w=s.write"  "for x in d: w(x)"  "s.getvalue()"

Before patch: 10 loops, best of 3: 28.7 msec per loop
After patch: 100 loops, best of 3: 14.8 msec per loop

They don't depend from the resizing factor on Linux. I increased it in hope it 
will help on Windows.

--

___
Python tracker 

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



[issue22193] Add _PySys_GetSizeOf()

2014-08-14 Thread Christian Heimes

Christian Heimes added the comment:

The code is missing an overflow check. There should be some verification that 
__sizeof__ returns a value smaller than SIZE_T_MAX - 24. Also 24 for GC 
overhead looks strange. IMHO it should be sizeof(PyGC_Head) which can be 
smaller than 24 bytes.

Python 3.5.0a0 (default:601045ceff94, Aug 14 2014, 22:59:49) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Overflow:
... def __sizeof__(self):
... return (1<<64)-1
... 
>>> sys.getsizeof(Overflow())
23

--
nosy: +christian.heimes
stage: resolved -> needs patch
status: closed -> open

___
Python tracker 

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



[issue22200] Remove distutils checks for Python version

2014-08-14 Thread Thomas Kluyver

New submission from Thomas Kluyver:

We noticed the other day that distutils, despite being part of the standard 
library, checks the version of Python it's running under and has some different 
code paths - one of which is only taken for Python < 2.2.

We haven't managed to figure out why this is necessary. So this issue is partly 
a patch and partly a question: is there a reason that distutils can't assume 
it's run on the version of Python it came with? If so, I'm happy to make a new 
patch adding a comment to explain that. If not, I'll go looking for other 
places where it has unnecessary checks, and we can clean up one little corner 
of wtf.

--
components: Distutils
files: rm-distutils-version-check.patch
keywords: patch
messages: 225320
nosy: dstufft, eric.araujo, takluyver
priority: normal
severity: normal
status: open
title: Remove distutils checks for Python version
Added file: http://bugs.python.org/file36372/rm-distutils-version-check.patch

___
Python tracker 

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



[issue21520] Erroneous zipfile test failure if the string 'bad' appears in pwd

2014-08-14 Thread Ismail Badawi

Changes by Ismail Badawi :


--
nosy: +ismail.badawi

___
Python tracker 

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



[issue22199] 2.7 sysconfig._get_makefile_filename should be sysconfig.get_makefile_filename

2014-08-14 Thread Ned Deily

Ned Deily added the comment:

Thanks for the report.  After reviewing the situation, I think this is actually 
a code bug rather than a documentation issue; in other words, things should 
work like the embedding documentation states.

sysconfig has a complicated history; there are currently 6 copies of sysconfig 
being actively maintained: Lib/sysconfig.py and Lib/distutils/sysconfig.py in 
each of the default (in progress 3.5), 3.4, and 2.7 branches. 5 of the 6 
versions have get_makefile_filename; only the 2.7 Lib/sysconfig.py copy has 
_get_makefile_filename.  Some of the history details here are probably not 
entirely accurate but I believe the basic story is as follows.  Historically, 
there was only a distutils/sysconfig.py and it has had a documented 
get_makefile_filename() for nearly forever.  Then, during the 2.7 and 3.2 
development cycles, a lot of effort went into new features for distutils, 
including creating Lib/sysconfig.py as a system-wide replacement for the 
distutils one.  As part of that feature, the get_makefile_filename function 
was, for some reason, deprecated and renamed to _get_makefile_filename in both 
the original distutils and the new Lib copies.  Later in the dev cycle, it was 
decided that it 
 would be better to avoid making major changes to distutils (and the distutils2 
project was started and later abandonded); as a result, the changes to 
distutils itself were reverted (mostly) prior to the 2.7 and 3.2 releases.  But 
the new Lib/sysconfig version was not modified to conform to the original (and 
now reverted to) name in the distutils version.  Still later, this discrepancy 
was noticed and Issue9877 was opened to change the name in Lib/sysconfig.py to 
get_makefile_file prior to its release in 3.2 but this was after 
Lib/sysconfig.py had already been released in 2.7 and the history of the 
otherwise reverted change in 2.7 may have been overlooked.  In any case, we now 
have this situation where Lib/sysconfig.py in 2.7 doesn't quite match any of 
the other versions, include its 2.7 Lib/distutils/sysconfig.py twin.

Although Lib/sysconfig.py _get_makefile_filename has never been documented, I 
think the safest and correct course of action is to change and document the 
name in 2.7 Lib/sysconfig.py but also continue to provide 
_get_makefile_filename as an alias.  The attached patch should do that.


https://docs.python.org/2/library/sysconfig.html
https://docs.python.org/3/library/sysconfig.html#sysconfig.get_makefile_filename
https://docs.python.org/2/distutils/apiref.html#distutils.sysconfig.get_makefile_filename
https://docs.python.org/3/distutils/apiref.html#distutils.sysconfig.get_makefile_filename

--
assignee: docs@python -> 
components: +Library (Lib) -Documentation
keywords: +patch
nosy: +barry, eric.araujo, ned.deily -docs@python
stage:  -> patch review
title: Embedding Python documentation error -> 2.7 
sysconfig._get_makefile_filename should be sysconfig.get_makefile_filename
Added file: http://bugs.python.org/file36373/issue22199_27.patch

___
Python tracker 

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



[issue21815] imaplib truncates some untagged responses

2014-08-14 Thread Lita Cho

Lita Cho added the comment:

pinging for another review. I have included tests for the patch as well as 
documentation!

--

___
Python tracker 

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



[issue21933] Allow the user to change font sizes with the text pane of turtledemo

2014-08-14 Thread Lita Cho

Lita Cho added the comment:

ping!

--

___
Python tracker 

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



[issue22195] Make it easy to replace print() calls with logging calls

2014-08-14 Thread Vinay Sajip

Vinay Sajip added the comment:

This is easy enough to do, I posted about it in 2009 here:

http://plumberjack.blogspot.co.uk/2009/09/how-to-treat-logger-like-output-stream.html

Basically, something like

class LoggerWriter(object):
def __init__(self, logger, level):
self.logger = logger
self.level = level

def write(self, message):
if message != '\n':
self.logger.log(self.level, message)

def flush(self):
pass

I'm not sure something like this really needs to be in the stdlib.

Loggers shouldn't have a method with a print-like signature, since it's 
Handlers that are concerned with output destinations such as streams.

--

___
Python tracker 

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



[issue22201] python -mzipfile fails to unzip files with folders created by zip

2014-08-14 Thread Antony Lee

New submission from Antony Lee:

With Python 3.4.1:

$ mkdir foo; zip -r foo{,}; python -mzipfile -e foo.zip dest
  adding: foo/ (stored 0%)
Traceback (most recent call last):
  File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
  File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "/usr/lib/python3.4/zipfile.py", line 1799, in 
main()
  File "/usr/lib/python3.4/zipfile.py", line 1777, in main
with open(tgt, 'wb') as fp:
IsADirectoryError: [Errno 21] Is a directory: 'dest/foo/'

Note that zipfile is actually able to unzip the file:

$ python -c 'from zipfile import *; ZipFile("foo.zip").extractall("dest")'

works fine.

If the zip file is created by "python -mzipfile -c foo.zip foo" then there is 
no problem.  Likewise, if there are no folders in the zip file (but just a 
collection of files) then there is no problem.

--
components: Library (Lib)
messages: 225325
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: python -mzipfile fails to unzip files with folders created by zip
versions: Python 3.4, Python 3.5

___
Python tracker 

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



[issue22200] Remove distutils checks for Python version

2014-08-14 Thread Aaron Meurer

Changes by Aaron Meurer :


--
nosy: +Aaron.Meurer

___
Python tracker 

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



[issue22202] Function Bug?

2014-08-14 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Thank you for the extensive examples, but I'm afraid this is not a bug.

In your code, "result" is a local variable, which means it only exists inside 
the fib() function. When you try inspecting "result", it fails because there is 
no global variable "result".

Try doing this instead:

result = fib(100)
result
result[3]


and it should work as you expect. (By the way, it doesn't matter if the local 
variable inside the fib() function and the global variable are different names 
or the same, in both cases they are considered different.)

--
nosy: +steven.daprano
resolution:  -> not a bug

___
Python tracker 

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



[issue22202] Function Bug?

2014-08-14 Thread Steven D'Aprano

Changes by Steven D'Aprano :


--
status: open -> closed

___
Python tracker 

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



[issue17390] display python version on idle title bar

2014-08-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6d41f139709b by Terry Jan Reedy in branch '2.7':
Issue #17390: Adjust Editor window title. Remove 'Python', move version to end.
http://hg.python.org/cpython/rev/6d41f139709b

New changeset ba141f9e58b6 by Terry Jan Reedy in branch '3.4':
Issue #17390: Adjust Editor window title. Remove 'Python', move version to end.
http://hg.python.org/cpython/rev/ba141f9e58b6

--

___
Python tracker 

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



[issue17390] display python version on idle title bar

2014-08-14 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
resolution:  -> fixed
stage: test needed -> resolved
status: open -> closed

___
Python tracker 

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



[issue22195] Make it easy to replace print() calls with logging calls

2014-08-14 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> This is easy enough to do, I posted about it in 2009 here

I know it's easy. It's still annoying to have to write such boilerplate by hand 
(especially when everyone ends up rewriting the exact same one).

--

___
Python tracker 

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



[issue21933] Allow the user to change font sizes with the text pane of turtledemo

2014-08-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am working on backporting the #10291 patch and re-synchronizing 3.4 and 3.5 
so revised version of this patch, including help change, and of #22065 patch 
can merge forward properly.

--

___
Python tracker 

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



[issue10291] Clean-up turtledemo in-package documentation

2014-08-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7708f80940b0 by Terry Jan Reedy in branch '3.4':
Issue #10291: Backport 004fe3449193 with a few changes due to 22095.
http://hg.python.org/cpython/rev/7708f80940b0

New changeset 68902ee48985 by Terry Jan Reedy in branch 'default':
Issue #10291: null merge
http://hg.python.org/cpython/rev/68902ee48985

--

___
Python tracker 

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



[issue22065] Update turtledemo menu creation

2014-08-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4349bbc21ca7 by Terry Jan Reedy in branch 'default':
Issue #22065: forward port the changes in c26862955342, update docstring with
http://hg.python.org/cpython/rev/4349bbc21ca7

--
nosy: +python-dev

___
Python tracker 

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



[issue22065] Update turtledemo menu creation

2014-08-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 59cc3bfdac4b by Terry Jan Reedy in branch 'default':
Issue #22065: Try the delete demohelp.txt part again.
http://hg.python.org/cpython/rev/59cc3bfdac4b

--

___
Python tracker 

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



[issue22065] Update turtledemo menu creation

2014-08-14 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
Removed message: http://bugs.python.org/msg225333

___
Python tracker 

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



[issue22053] turtledemo: clean up start and stop, fix warning

2014-08-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

After backporting 004fe3449193 (#10921 3.5 patch) with changes as 7708f80940b0, 
forward port to 3.5 the 3.4 patch c26862955342 that did not merge before.  The 
3.4 and 3.5 files are identical.

Misdirected changeset notices:

New changeset 4349bbc21ca7 by Terry Jan Reedy in branch 'default':
Issue #22065: forward port the changes in c26862955342, update docstring with
http://hg.python.org/cpython/rev/4349bbc21ca7

New changeset 59cc3bfdac4b by Terry Jan Reedy in branch 'default':
Issue #22065: Try the delete demohelp.txt part again.
http://hg.python.org/cpython/rev/59cc3bfdac4b

--

___
Python tracker 

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



[issue22065] Update turtledemo menu creation

2014-08-14 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
Removed message: http://bugs.python.org/msg225332

___
Python tracker 

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



[issue22065] Update turtledemo menu creation

2014-08-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The two misdirected and unlinked changeset notices belong to #22053.
(Not completely off, as they synchronize 3.4 and 3.5 so I can start work on 
this.)

--

___
Python tracker 

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



[issue22053] turtledemo: clean up start and stop, fix warning

2014-08-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5aa3f4863dda by Terry Jan Reedy in branch '3.4':
#22053: actually remove .txt files from 3.4.
http://hg.python.org/cpython/rev/5aa3f4863dda

--

___
Python tracker 

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



[issue22195] Make it easy to replace print() calls with logging calls

2014-08-14 Thread Raymond Hettinger

Raymond Hettinger added the comment:

This is a recurring problem.  I concur with Antoine that there needs to be 
logging functions that are harmonized with print().

--
nosy: +rhettinger

___
Python tracker 

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



[issue22203] inspect.getargspec() returns wrong spec for builtins

2014-08-14 Thread Alexander Schepanovski

New submission from Alexander Schepanovski:

inspect.getargspec() returns empty ArgSpec for map() and filter():

>>> import inspect
>>> inspect.getargspec(map)
ArgSpec(args=[], varargs=None, keywords=None, defaults=None)
>>> inspect.getargspec(filter)
ArgSpec(args=[], varargs=None, keywords=None, defaults=None)

Not sure if other builtins affected.

--
components: Library (Lib)
messages: 225338
nosy: suor
priority: normal
severity: normal
status: open
title: inspect.getargspec() returns wrong spec for builtins
type: behavior
versions: Python 3.4, Python 3.5

___
Python tracker 

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



[issue22065] Update turtledemo menu creation

2014-08-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 39c67beb483a by Terry Jan Reedy in branch '3.4':
Issue #22065: Update turtledemo menu creation; don't use obsolete Menubutton.
http://hg.python.org/cpython/rev/39c67beb483a

--

___
Python tracker 

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



[issue22198] Odd floor-division corner case

2014-08-14 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> ideally, a floating-point operations works as though the
> corresponding mathematical operation were performed exactly 
>on the inputs (considered as real numbers), followed by a rounding
> step that takes the resulting real number and rounds it to the 
> nearest floating-point number.

FWIW, the Decimal Arithmetic Specification was created around the same 
principle.   Accordingly, it gets the answer that Mark expected:

  >>> from decimal import Decimal
  >>> Decimal('-0.5') // Decimal('Inf')
  Decimal('-0')

--
nosy: +rhettinger

___
Python tracker 

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



[issue22193] Add _PySys_GetSizeOf()

2014-08-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This was discussed in issue15490. Such implementation is just incorrect, 
because we cannot allocate such much memory.

--

___
Python tracker 

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



[issue22065] Update turtledemo menu creation

2014-08-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The changes to help menu creation in #22053 required hand patching of the last 
chunk, but that was pretty easy. The code definitely looks better for the 
change.

After pushing, I compared the look to 2.7. The first letters are not 
underlined, but Alt- works, as on Idle (where File prevent key 
access to Format). This looks better, but I don't know if the underline helps 
beginners.

In spite of
   self.mBar.add_cascade(menu=self.makeLoadDemoMenu(self.mBar),
  label='Examples', underline=0, font=menufont)
passing menufont, the font for the menubar entries, 'Examples' and 'Help', is 
no longer the 12 pt menufont, but looks like 10 pt (as on Idle). It is 
initially lighter than it was before until clicked. The dropdown entries (added 
with add_command instead of add_cascade) do use the 12 pt menufont as passed. 
The size difference looks a bit strange. So if anyone knows why, speak up.

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

___
Python tracker 

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



[issue20334] make inspect Signature hashable

2014-08-14 Thread Antony Lee

Antony Lee added the comment:

The hash function of the Signature class is actually incompatible with the 
definition of Signature equality, which doesn't consider the order of 
keyword-only arguments:

>>> from inspect import signature
>>> s1 = signature(lambda *, x, y: None); s2 = signature(lambda *, y, x: None)
>>> s1 == s2
True
>>> hash(s1) == hash(s2)
False

Actually the implementation of Signature.__eq__ seems way too complicated; I 
would suggest making a helper method returning (return_annotation, 
tuple(non-kw-only-params), frozenset(kw-only-params)) so that __eq__ can 
compare these values while __hash__ can hash that tuple.

--
nosy: +Antony.Lee

___
Python tracker 

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



[issue22192] dict_values objects are hashable

2014-08-14 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Do you want to submit a patch and tests?
Also take a look at the collections.abc MappingViews.

--
assignee:  -> rhettinger
nosy: +gvanrossum
priority: normal -> low
stage:  -> needs patch

___
Python tracker 

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



[issue22196] namedtuple documentation could/should mention the new Enum type

2014-08-14 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: docs@python -> rhettinger
nosy: +rhettinger
priority: normal -> low

___
Python tracker 

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