[issue23119] Remove unicode specialization from set objects

2015-01-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be add the unicode specialization right in PyObject_RichCompareBool?

--

___
Python tracker 

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



[issue23255] SimpleHTTPRequestHandler refactor for more extensible usage.

2015-01-24 Thread Ent

Ent added the comment:

Based on the comments of many good netizens,
I have further updated the patch.

--
Added file: http://bugs.python.org/file37849/jan25.patch

___
Python tracker 

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



[issue3566] httplib persistent connections violate MUST in RFC2616 sec 8.1.4.

2015-01-24 Thread Demian Brecht

Demian Brecht added the comment:

Thanks for the patch Martin (as well as catching a couple issues that I'd run 
into recently as well). I've left a couple comments up on Rietveld.

--

___
Python tracker 

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



[issue23119] Remove unicode specialization from set objects

2015-01-24 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thanks Mark. I appreciate the effort looking at use cases.

I'm reopening this one because I have an alternative patch that simplifies the 
code but keeps the unicode specialization.  It replaces the lookkey indirection 
with a fast and predictable inline test for PyUnicode_CheckExact.  The timings 
show no measureable difference, but the code is simpler and the setobject size 
is reduced by one pointer.  This simplify future maintenance and development as 
well as making the code more pleasant.

--
resolution: rejected -> 
stage:  -> patch review
status: closed -> open
Added file: http://bugs.python.org/file37848/inline_unicode_specialization.diff

___
Python tracker 

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



[issue23152] fstat64 required on Windows

2015-01-24 Thread Steve Dower

Steve Dower added the comment:

Huh, okay, looks like the patch still isn't sufficient (I forgot to put -uall 
when testing it...) - there are calls in fileio.c that need changing too.

I'll try and do a thorough sweep of calls to fstat and post another patch in 
the next day or so.

--

___
Python tracker 

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



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

2015-01-24 Thread Martin Panter

Martin Panter added the comment:

Here is patch v4. The stream writer is now automatically generated by default 
by the CodecInfo constructor if no custom stream writer parameter is supplied. 
The base64 and quopri codecs are adjusted to also use this default stream 
writer to help with Issue 20132.

--
Added file: http://bugs.python.org/file37847/zlib-bz2-writer.v4.patch

___
Python tracker 

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



[issue21279] str.translate documentation incomplete

2015-01-24 Thread Martin Panter

Martin Panter added the comment:

I’m happy with the new wording in v5. Maybe the docstring in the C module could 
be reflowed though.

--

___
Python tracker 

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



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

2015-01-24 Thread Martin Panter

Martin Panter added the comment:

Here is a new patch which fixes the bytes-to-bytes incremental codecs. It 
depends on my patches for these other issues being applied first:

* Issue 23231: Bytes-to-bytes support for iteren/decode()
* Issue 13881: Generic StreamWriter from IncrementalEncoder
* Issue 16473: Clarify and test quopri-codec implementation

In addition, without the fix for Issue 20121 (Quoted printable soft line 
breaking), the patch will apply, but there will be test failures.

Summary of the changes in this patch:

* Fix simple bz2-codec bug uncovered by new tests
* Implement stateful hex-codec IncrementalDecoder
* Add helpers for getstate() and setstate() to bijectively convert between 
arbitrary-length byte strings and integers
* Implement stateful base64-codec IncrementalEncoder; use it for the 
StreamWriter
* base64-codec IncrementalDecoder
* quopri-codec IncrementalEncoder, StreamWriter, IncrementalDecoder
* uu-codec IncrementalEncoder, StreamWriter, IncrementalDecoder
* Document that bytes-to-bytes StreamReader is not supported
* Document stateful raw-/unicode-escape decoding not supported
* Warn that stateful UTF-7 encoding may not be optimal, and that stateful UTF-7 
decoding may buffer unlimited input

This patch is actually generated from a series of patches folded together. If 
anyone is interested, I could try pushing the original series to a Bitbucket 
repository or something.

--
Added file: http://bugs.python.org/file37846/inc-codecs.diff

___
Python tracker 

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



[issue23300] httplib is using a method that doesn't exist

2015-01-24 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Committed the test changes in  fcab9c106f2f (3.4) and  a858cde113f2 (3.5)

--
status: open -> closed

___
Python tracker 

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



[issue23300] httplib is using a method that doesn't exist

2015-01-24 Thread Berker Peksag

Berker Peksag added the comment:

LGTM.

--

___
Python tracker 

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



[issue23303] test_license_exists_at_url() of test_site fails on "x86 XP-4 3.4" buildbot

2015-01-24 Thread Ned Deily

Ned Deily added the comment:

Are the Windows 3.4 and 3.x builds on the buildbot using different versions of 
OpenSSL?  Certificate verifies would fail with 0.9.7.

--
nosy: +ned.deily

___
Python tracker 

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



[issue23152] fstat64 required on Windows

2015-01-24 Thread Steve Dower

Changes by Steve Dower :


Added file: http://bugs.python.org/file37845/py_fstat_2.patch

___
Python tracker 

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



[issue23152] fstat64 required on Windows

2015-01-24 Thread Steve Dower

Steve Dower added the comment:

I updated and tested your patch - basically making posixmodule.c use the new 
_Py_stat_struct throughout instead of the Win32 definition. The tests run fine 
on my VC14 machine.

Should _Py_fstat be conditioned on Py_LIMITED_API in some way, since it's not 
available pre-3.5? I've never figured out exactly how that should work.

--

___
Python tracker 

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



[issue23300] httplib is using a method that doesn't exist

2015-01-24 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Thanks for the review comments. Updated the patch with the suggested changes.

--
Added file: http://bugs.python.org/file37844/23300-3.3-v2.patch

___
Python tracker 

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



[issue23300] httplib is using a method that doesn't exist

2015-01-24 Thread Berker Peksag

Berker Peksag added the comment:

+self.assertDictEqual(self.conn._tunnel_headers, tunnel_headers)

You could just use assertEqual. Quoting from docs:

"The list of type-specific methods automatically used by assertEqual() are 
summarized in the following table. Note that it’s usually not necessary to 
invoke these methods directly."

https://docs.python.org/3/library/unittest.html#unittest.TestCase.addTypeEqualityFunc

+self.assertTrue(b'CONNECT destination.com' in self.conn.sock.data)
+self.assertTrue(b'Host: destination.com' in self.conn.sock.data)

You could use assertIn instead.

--

___
Python tracker 

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



[issue23232] 'codecs' module functionality + its docs -- concerning custom codecs, especially non-string ones

2015-01-24 Thread Martin Panter

Martin Panter added the comment:

I am certainly no expert, but this is how I understand the three different 
kinds of codecs are used:

* Stateless codecs: str.encode(), bytes.decode(), etc
* Incremental codecs: TextIOWrapper, IncrementalNewlineDecoder
* Stream codecs: only stuff inside the “codecs” module as far as I know: 
codecs.open(), EncodedFile() etc.

--

___
Python tracker 

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



[issue3566] httplib persistent connections violate MUST in RFC2616 sec 8.1.4.

2015-01-24 Thread Martin Panter

Martin Panter added the comment:

Updated v2 patch. This version avoids intruding into the 
HTTPConnection.connect() implementation, so that users, tests, etc may still 
set the undocumented “sock” attribute without calling the base connect() 
method. Also code style changes based on feedback to another of my patches.

--
versions:  -Python 2.7, Python 3.4
Added file: http://bugs.python.org/file37843/ConnectionClosed.v2.patch

___
Python tracker 

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



[issue23300] httplib is using a method that doesn't exist

2015-01-24 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Actually, the same tests cannot be ported to 3.4 or default. httplib.HTTP class 
has been merged to HTTPConnection in 3.x and we don't allow a host, and port in 
connect().

There is good test coverage for verifying host, port in test_hort_port test in 
3.x

However, I saw that TunnelTests could see some refactor and a test addition to 
cover the _tunnel_host, _tunnel_port attributes (which are set using 
_get_hostport method). 

Attaching a change to client.test_httplib which refactors TunnelTest and adds a 
new test called test_set_tunnel_host_port_headers. Please review if this change 
is Okay. I can push this in 3.4 and default branches.

Thanks!

--
Added file: http://bugs.python.org/file37842/23300-3.3.patch

___
Python tracker 

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



[issue21548] pydoc -k IndexError on empty docstring

2015-01-24 Thread Berker Peksag

Berker Peksag added the comment:

Here's a patch with tests.

--
nosy: +berker.peksag
stage:  -> patch review
Added file: http://bugs.python.org/file37841/issue21548.diff

___
Python tracker 

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



[issue23314] Disabling CRT asserts in debug build

2015-01-24 Thread Steve Dower

New submission from Steve Dower:

When we completely switch Windows builds over to VC14, we're going to encounter 
some new assert dialogs from the CRT. These won't appear in release builds, but 
because the buildbots run tests against debug builds they will get in the way. 
A number of tests attempt operations on bad file descriptors, which will assert 
and terminate in MSVCRT (I have a fix for the termination coming, but the 
assertions will still appear).

Currently regrtest has a "-n" flag to disable assertions using an MSVCRT 
function. This works fine with the exception of subprocesses, that do not 
inherit the setting.

The setting is process-wide, so we can't just turn assertions off around the 
code that may assert. We also can't turn them off completely without affecting 
users (e.g. #3545 and #4804).

#4804 has the discussion leading to the current state where _PyVerify_fd and 
the -n flag above exist. The _PyVerify_fd function could break with future CRT 
changes (bearing in mind that Python 3.5 and later will automatically use the 
latest installed CRT), for which there is an official workaround coming soon, 
except it won't suppress the assertion dialog for debug builds.

I'd like to propose three options:

1. Make faulthandler.enable() also disable assertions in debug builds. 
(Assertions are for debugging, and enabling faulthandler - at least on Windows 
- seems to suggest that you want to override the debugger. We also already 
enable faulthandler for subprocesses in the test suite.)

2. Add an environment variable (PYTHONDISABLECRTASSERT?) and use it to disable 
assertions on startup. (It looks like at least some tests deliberately block 
envvars flowing through to subprocesses, so this may require test changes too.)

3. Add a new xoption and use it to disable assertions on startup.

Obviously we could do all three, though I kind of like the first one best.

Currently, I'm planning to make debug builds available alongside the release 
versions, as they are necessary for people to build debuggable versions of 
their extensions, so this is more important than it was in the past. But the 
problem is very much only on the buildbots/in the test suite and not on user's 
machines.

Thoughts?

--
components: Windows
messages: 234640
nosy: haypo, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Disabling CRT asserts in debug build
type: crash
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



[issue23300] httplib is using a method that doesn't exist

2015-01-24 Thread Senthil Kumaran

Senthil Kumaran added the comment:

> Would porting the tests be useful, though?

Yes, it will be useful to port the tests to 3.4 and default branch.
I will do that.

--
status: closed -> open

___
Python tracker 

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



[issue23300] httplib is using a method that doesn't exist

2015-01-24 Thread Benjamin Peterson

Benjamin Peterson added the comment:

On Sat, Jan 24, 2015, at 16:00, Senthil Kumaran wrote:
> 
> Senthil Kumaran added the comment:
> 
> Fixed in 2.7. Other versions do not have this bug.

Thank you! Would porting the tests be useful, though?

--

___
Python tracker 

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



[issue23300] httplib is using a method that doesn't exist

2015-01-24 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Fixed in 2.7. Other versions do not have this bug.

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



[issue23260] Update Windows installer

2015-01-24 Thread Steve Dower

Changes by Steve Dower :


--
nosy: +larry

___
Python tracker 

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



[issue23300] httplib is using a method that doesn't exist

2015-01-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c2bba3c9424b by Senthil Kumaran in branch '2.7':
Fix Issue23300 : httplib.HTTP classe's connect method should use _get_hostport
https://hg.python.org/cpython/rev/c2bba3c9424b

--
nosy: +python-dev

___
Python tracker 

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



[issue23255] SimpleHTTPRequestHandler refactor for more extensible usage.

2015-01-24 Thread Ent

Ent added the comment:

New patch for review! Let me know if anything is missing.

--
Added file: http://bugs.python.org/file37840/jan24th.patch

___
Python tracker 

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



[issue23312] google thinks the docs are mobile unfriendly

2015-01-24 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag

___
Python tracker 

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



[issue23312] google thinks the docs are mobile unfriendly

2015-01-24 Thread Georg Brandl

Georg Brandl added the comment:

Yes, the theme is anything but "responsive".  If someone already knows how to 
do this, please step forward.

I guess it's not too hard to move the sidebar to the top/bottom on mobile, and 
adapt the font sizes.

--

___
Python tracker 

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



[issue23292] Enum doc suggestion

2015-01-24 Thread Georg Brandl

Georg Brandl added the comment:

Likewise, I don't feel strongly that it *should* go in, but I wouldn't object 
to it.

--

___
Python tracker 

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



[issue23313] Wrong complex variable being altered

2015-01-24 Thread Gerrit Barrere

New submission from Gerrit Barrere:

The bug occurs on line 77 of the attached script. When I change the imaginary 
part of 'z' on line 77, it also changes the imaginary part of 'zload', which is 
supposed to remain constant.  Putting a dummy assignment 'z = z + 0' on line 76 
fixes the bug.  This is all described in the comments around line 77 also.

I found this in the PyCharm IDE by putting a breakpoint just after line 77 and 
watching variables 'z' and 'zload'.  The function 'model()' is called 
repeatedly in this script, and you can see 'zload' changing every time the 
function is called.

--
files: ComplexBug.py
messages: 234631
nosy: CarpeCimex
priority: normal
severity: normal
status: open
title: Wrong complex variable being altered
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file37839/ComplexBug.py

___
Python tracker 

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



[issue23199] libpython27.a in amd64 release is 32-bit

2015-01-24 Thread Paul Moore

Paul Moore added the comment:

There's a lot of politics around the mingw vs mingw64 situation, but in 
practice I believe the various mingw64 builds are fine. So I see no reason not 
to supply a correct 64-bit libpythonXY.a.

When the patch was made to include the libpythonXY.a file to the msi (wow! I'd 
forgotten I'd ever done a patch for the MSI build) there was only 32-bit 
systems, and there certainly wasnt't a 64-bit mingw.

The added patch seems like a reasonable approach.

--

___
Python tracker 

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



[issue23292] Enum doc suggestion

2015-01-24 Thread Eli Bendersky

Eli Bendersky added the comment:

Georg, each library writer is entitled to do whatever she wants. Naturally, we 
can't prevent dumping contents of enums into the module namespaces, and yes, 
backwards compatibility makes sense for some modules.

However, that's tangential to *encouraging* this un-Pythonic behavior by 
including the trick in the official documentation. After all, namespaces is a 
good idea (from the Zen of Python), and Enums as namespaces are also a good 
idea (self-documenting code).

There's a huge amount of tricks we could add to the documentation, but we 
don't. There's wikis for that, blogs, Stack Overflow, Active Python recipes, 
what have you.

I wouldn't spend too much time arguing about this, though. If you feel strongly 
that this belongs in the standard documentation, go ahead. I just wanted to 
provide an alternative view of the issue.

--

___
Python tracker 

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



[issue23311] Update PC/example_nt and extending/windows.rst

2015-01-24 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



[issue23260] Update Windows installer

2015-01-24 Thread Steve Dower

Steve Dower added the comment:

Updated patch, and hopefully it will make it into review this time.

I deliberately excluded the image for the using/windows.rst documentation but 
you can see it at http://imgur.com/CdQaBmp

--
Added file: http://bugs.python.org/file37838/23260_3.diff

___
Python tracker 

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



[issue23312] google thinks the docs are mobile unfriendly

2015-01-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +georg.brandl, serhiy.storchaka
versions:  -Python 3.6

___
Python tracker 

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



[issue23257] Update Windows build/setup instructions in devguide

2015-01-24 Thread Steve Dower

Changes by Steve Dower :


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



[issue23257] Update Windows build/setup instructions in devguide

2015-01-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 41d2d182c260 by Steve Dower in branch 'default':
Issue 23257: Update Windows build/setup instructions.
https://hg.python.org/devguide/rev/41d2d182c260

--
nosy: +python-dev

___
Python tracker 

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



[issue23311] Update PC/example_nt and extending/windows.rst

2015-01-24 Thread Steve Dower

Steve Dower added the comment:

This is probably also a good place to refer to the changes in #22980 and how 
they can help when building extensions outside of distutils.

--

___
Python tracker 

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



[issue23311] Update PC/example_nt and extending/windows.rst

2015-01-24 Thread Steve Dower

New submission from Steve Dower:

The installer for 3.5 will include an option to install debug binaries 
alongside the release ones, so we should update extending/windows.rst to 
explain that and generally describe how to build an extension. It should also 
refer to python3.dll at least once...

The example project in PC/example_nt is fairly outdated. It could be updated to 
automatically find a 3.5 install and use the debug or release 
binaries/libraries from there.

We could also include a 'test' project for PTVS (http://pytools.codeplex.com/) 
that helps write Python code for testing the extension and also has mixed-mode 
debugging enabled so people can step between the Python and the C code.

(In fact, the PTVS team wants to do a sample project like this anyway, so maybe 
we can remove PC/example_nt and point to theirs...)

--
assignee: docs@python
components: Documentation, Windows
messages: 234624
nosy: docs@python, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Update PC/example_nt and extending/windows.rst
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



[issue23312] google thinks the docs are mobile unfriendly

2015-01-24 Thread Benjamin Peterson

New submission from Benjamin Peterson:

According to Google webmaster tools, the documentation has the following 
failings on mobile devices:

- The font size is too small. 
https://developers.google.com/speed/docs/insights/UseLegibleFontSizes
- The viewport is not configured.
- Touch controls are too close together.

You can look at the complaints on (for example) 
https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fdocs.python.org%2F3%2Flibrary%2Ffunctions.html

--
assignee: docs@python
components: Documentation
messages: 234625
nosy: benjamin.peterson, docs@python
priority: normal
severity: normal
stage: needs patch
status: open
title: google thinks the docs are mobile unfriendly
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue23310] MagicMock constructor configuration fails for magic methods

2015-01-24 Thread berdario

New submission from berdario:

I guess this should be expected... too much magic :P

>>> from unittest.mock import MagicMock
>>> MagicMock(**{'__hash__.return_value': "FIXME"})
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/mock.py",
 line 1772, in __init__
_safe_super(MagicMixin, self).__init__(*args, **kw)
  File 
"/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/mock.py",
 line 881, in __init__
_spec_state, _new_name, _new_parent, **kwargs
  File 
"/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/mock.py",
 line 410, in __init__
self.configure_mock(**kwargs)
  File 
"/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/mock.py",
 line 560, in configure_mock
setattr(obj, final, val)
AttributeError: 'method-wrapper' object has no attribute 'return_value'


The same happens with e.g. __str__

>>> m.configure_mock(**{'__hash__.return_value': 1})

works just fine, instead

--
components: Library (Lib)
messages: 234623
nosy: berdario
priority: normal
severity: normal
status: open
title: MagicMock constructor configuration fails for magic methods
versions: Python 3.4

___
Python tracker 

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



[issue23253] Delay-load ShellExecute

2015-01-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5bff604a864e by Steve Dower in branch 'default':
Closes #23253: Delay-load ShellExecute
https://hg.python.org/cpython/rev/5bff604a864e

--
nosy: +python-dev
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



[issue23253] Delay-load ShellExecute

2015-01-24 Thread Steve Dower

Steve Dower added the comment:

I assume you're referring to normal_startup and startup_nosite in perf.py at 
h.p.o/benchmarks? Handy to know about (I need to explore our top-level repos 
more often, obviously), but probably still not going to measure time in the 
Windows PE loader as accurately as it'd need to be to conclusively prove a 
speed advantage. I'd probably need to hit up the Windows team for some of their 
profiling tools to get good numbers here.

Still, it's indisputable that this change will reduce the initial memory 
overhead, so I'll take Tim's 0.75 and run with it :)

--

___
Python tracker 

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



[issue21408] delegation of `!=` to the right-hand side argument is not always done

2015-01-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There are few incorrect implementations of __ne__ in the stdlib. Updated patch 
removes them. May be we should remove all implementations of __ne__ which are 
redundant now.

--
Added file: http://bugs.python.org/file37837/method-not-operator-2.patch

___
Python tracker 

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



[issue23199] libpython27.a in amd64 release is 32-bit

2015-01-24 Thread Steve Dower

Steve Dower added the comment:

It looks like #1088716 is where the change was made a bit over 10 years ago. 
Adding Paul to see if he has any further insight, but I'm pretty sure at that 
point there was no 64-bit Python (there certainly wasn't a 64-bit Windows that 
people were using), and probably nobody noticed/cared that it wasn't there. It 
may even have been missing completely from the 64-bit installer until I took 
over building and started doing it slightly differently from Martin.

I've attached a patch for msi.py that will use mingw-w64's tools when building 
the installer, but I suspect we're better off putting the instructions there 
rather than hoping build versions match.

Is there a mingw list we can post this thread to for opinions from more people 
who depend on this lib?

--
keywords: +patch
nosy: +pmoore
Added file: http://bugs.python.org/file37836/23199.diff

___
Python tracker 

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



[issue21408] delegation of `!=` to the right-hand side argument is not always done

2015-01-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Particular case of this bug:

>>> class A:
... def __eq__(self, other): return NotImplemented
... 
>>> A().__eq__(object())
NotImplemented
>>> A().__ne__(object())
True

The second result should be NotImplemented.

Martin's patch LGTM except few style nitpicks to tests.

--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka
stage:  -> commit review

___
Python tracker 

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



[issue23268] Fix comparison of ipaddress classes

2015-01-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
dependencies: +delegation of `!=` to the right-hand side argument is not always 
done

___
Python tracker 

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



[issue23268] Fix comparison of ipaddress classes

2015-01-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> The fact the default __ne__ implementation doesn't handle NotImplemented 
> correctly should probably be filed as a separate issue.

May be this is a part of issue21408.

--

___
Python tracker 

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



[issue23308] a bug in Instructions section 4.1

2015-01-24 Thread Kevin Dwyer

Kevin Dwyer added the comment:

@Dmot
Can you be more specific about the problem?  A link to the instructions that 
you are following and a verbatim copy of any error message that you see would 
help to identify what's going wrong.

--
nosy: +kdwyer

___
Python tracker 

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



[issue23309] Hang on interpreter shutdown if daemon thread prints to stdout

2015-01-24 Thread Marien Zwart

New submission from Marien Zwart:

A script spawning a single daemon thread calling print() in a loop (like the 
attached) will usually hang on shutdown in Python 3.4.2 and hg rev 
8d802fb6ae32. Attaching gdb at that point shows the following:

(gdb) thread apply all bt

Thread 1 (Thread 0x7fd927d58700 (LWP 30274)):
#0  sem_wait () at ../sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
#1  0x005282fe in PyThread_acquire_lock_timed (lock=0x1c5ea30, 
microseconds=microseconds@entry=-1, 
intr_flag=intr_flag@entry=0) at Python/thread_pthread.h:352
#2  0x00528414 in PyThread_acquire_lock (lock=, 
waitflag=waitflag@entry=1)
at Python/thread_pthread.h:556
#3  0x00567e4c in _enter_buffered_busy (self=0x7fd927bc2b48) at 
./Modules/_io/bufferedio.c:327
#4  buffered_flush (self=0x7fd927bc2b48, args=) at 
./Modules/_io/bufferedio.c:874
#5  0x0042822a in PyObject_Call (func=0x7fd9277b69d8, arg=, kw=)
at Objects/abstract.c:2086
#6  0x004290e4 in call_function_tail (args=0x7fd927b8d048, 
callable=0x7fd9277b69d8) at Objects/abstract.c:2124
#7  callmethod (is_size_t=1, va=0x7fff5c6cf6b0, format=0x0, 
func=0x7fd9277b69d8) at Objects/abstract.c:2193
#8  _PyObject_CallMethodId_SizeT (o=, name=, 
format=0x0) at Objects/abstract.c:2279
#9  0x0042822a in PyObject_Call (func=0x7fd9277b6990, arg=, kw=)
at Objects/abstract.c:2086
#10 0x00428cc4 in call_function_tail (args=0x7fd927b8d048, 
callable=0x7fd9277b6990) at Objects/abstract.c:2124
#11 callmethod (is_size_t=0, va=0x7fff5c6cf7e0, format=0x5b9924 "", 
func=0x7fd9277b6990) at Objects/abstract.c:2193
#12 _PyObject_CallMethodId (o=o@entry=0x7fd927b5d3a8, name=name@entry=0x862b00 
, 
format=format@entry=0x5b9924 "") at Objects/abstract.c:2238
#13 0x0050a521 in flush_std_files () at Python/pylifecycle.c:488
#14 0x0050a5aa in Py_Finalize () at Python/pylifecycle.c:550
#15 0x0041fc92 in Py_Main (argc=-1, argv=0x1) at Modules/main.c:787
#16 0x0041be3c in main (argc=2, argv=) at 
./Programs/python.c:69

The daemon thread has exited, and the main thread hangs trying to flush stdout.

I haven't fully tracked down what happens here, but I think it's this:

- daemon thread calls ENTER_BUFFERED on stdout
- daemon thread drops the GIL before writing to stdout
- main thread grabs the GIL and starts exiting
- main thread sets _Py_Finalizing, signaling daemon threads to exit
- main thread calls flush_std_files and drops the GIL
- daemon thread grabs the GIL and immediately exits, without reaching 
LEAVE_BUFFERED
- main thread deadlocks trying to ENTER_BUFFERED the same file

If that is what happens, I don't really see how to fix it (it's an example of 
daemon threads not releasing their resources, which the documentation warns 
about). But it's obviously unfortunate if merely writing to stdout/err is such 
a resource.

--
components: Interpreter Core
files: dio.py
messages: 234615
nosy: marienz
priority: normal
severity: normal
status: open
title: Hang on interpreter shutdown if daemon thread prints to stdout
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file37835/dio.py

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2015-01-24 Thread Nick Coghlan

Nick Coghlan added the comment:

I haven't looked into the details of how cProfile handles command line 
arguments, but potentially relevant is issue #19982, which proposes adding a 
"target" parameter that lets runpy run in the context of an existing module 
object, rather than always creating its own.

However, if this can be implemented without that, go ahead - it can always be 
refactored later.

--

___
Python tracker 

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



[issue17840] base64_codec uses assert for runtime validity checks

2015-01-24 Thread Nick Coghlan

Nick Coghlan added the comment:

I'd be slightly more inclined to file the fact that "ignore" isn't supported by 
the base64 codec as a potential bug, with changing the docs as one possible 
resolution.

It shouldn't hold up switching from the assertions to proper runtime checks.

--

___
Python tracker 

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



[issue23268] Fix comparison of ipaddress classes

2015-01-24 Thread Nick Coghlan

Nick Coghlan added the comment:

+1, looks good to me.

That test for ordering and comparison interoperability is actually pretty neat 
- I wonder if we could make it more generally available as a "check my class 
handles NotImplemented correctly" check (in unittest?), which would potentially 
be useful in pursuing a fix for issue #11477.

The fact the default __ne__ implementation doesn't handle NotImplemented 
correctly should probably be filed as a separate issue.

--

___
Python tracker 

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



[issue23292] Enum doc suggestion

2015-01-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Agree with Eli.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue21076] Turn signal.SIG* constants into enums

2015-01-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And more:

>>> import signal
>>> signal.signal(1.2, signal.SIG_DFL)

>>> signal.signal('1', signal.SIG_DFL)


--

___
Python tracker 

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



[issue9740] Support for HTTP 1.1 persistent connections throughout the standard library

2015-01-24 Thread Martin Panter

Martin Panter added the comment:

See Issue 3566 about tweaking the “http.client” module’s BadStatusLine handling 
to be more helpful when implementing persistent connections. I am dumping some 
thoughts here about persistent connections with the “http.client” module, 
gained by working on that bug.

* Lib/xmlrpc/client.py appears to have persistent connection support, so may be 
useful for this bug.

* RFC 7230 §6.5  mentions 
monitoring for connection closure. This could be be partly implemented inside 
HTTPConnection by polling for closure before sending a request, but to fully 
implement might require the co-operation of the user calling into the module to 
check for closure at other times using select() or similar.

* Current “http.client” assumes that each socket.makefile() object will not 
buffer any data from a subsequent response. Unsure if this is a problem in the 
real world, but I ran into it implementing test cases. E.g. if the server 
anticipates the first few bytes of the subsequent response:

c.send(b"HTTP/1.1 200 Okay\r\nContent-Length: 0\r\n\r\n" b"HTTP/")

then the client misses the “HTTP/” and raises BadStatusLine("1.1 200 Okay\r\n").

--

___
Python tracker 

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



[issue21076] Turn signal.SIG* constants into enums

2015-01-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Now signal.signal() accepts inappropriate types.

>>> signal.signal(signal.SIGHUP, 0.0)

>>> signal.signal(signal.SIGHUP, '0')


In 3.4 it raised an exception.

--
status: closed -> open

___
Python tracker 

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



[issue22286] Allow backslashreplace error handler to be used on input

2015-01-24 Thread Nick Coghlan

Nick Coghlan added the comment:

+1 from me for merging, although I suspect you'll need to adjust the codecs.rst 
changes first.

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



[issue23307] python hangs on call to numpy.outer

2015-01-24 Thread Mark Dickinson

Changes by Mark Dickinson :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue23292] Enum doc suggestion

2015-01-24 Thread Georg Brandl

Georg Brandl added the comment:

I disagree. I assume that many new enums will be a replacement for module-level 
constants, but these still have to be available on the module. Keeping backward 
compatibility is not against the spirit of Python :)

--

___
Python tracker 

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



[issue4395] Document auto __ne__ generation; provide a use case for non-trivial __ne__

2015-01-24 Thread Martin Panter

Martin Panter added the comment:

The reference to @functools.total_ordering was actually already there; I just 
moved it into the paragraph about relationships between the operators. I should 
also point out that my description of the default __ne__() assumes that Issue 
21408 is resolved; the current behaviour is slightly different.

If you think something else could be added to the patch, I’m happy to try and 
add it. Perhaps the default object.__eq__() behaviour?

--

___
Python tracker 

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



[issue23292] Enum doc suggestion

2015-01-24 Thread Eli Bendersky

Eli Bendersky added the comment:

I'm not sure why the current situation is annoying?

Python explicitly does not pollute the enclosing namespace with an Enum's 
members. So when you:

import A

It's fairly natural that you have access to A.MyEnum and not its members, no? 
Some modules (like some stdlib modules) may choose to push the enum members up 
to the module's scope explicitly, but I wouldn't necessarily call it best 
practice. Namespacing is Pythonic, splashing contents of classes into enclosing 
namespaces isn't.

So I guess what I'm trying to say is that I don't see a reason to explicitly 
suggest something that is, in general, against the spirit of Python, in the 
documentation.

[P.S. Thanks for reporting, Mark, I love your books!]

--

___
Python tracker 

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



[issue23232] 'codecs' module functionality + its docs -- concerning custom codecs, especially non-string ones

2015-01-24 Thread Nick Coghlan

Nick Coghlan added the comment:

Regarding the 6 vs 4 interfaces, what's really needed there is a clearer 
explanation of what functionality depends on each of the three interfaces 
(basic, stream, incremental), so that a codec developer has a clearer 
understanding of what won't work if they don't provide a particular interface.

--

___
Python tracker 

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



[issue23232] 'codecs' module functionality + its docs -- concerning custom codecs, especially non-string ones

2015-01-24 Thread Nick Coghlan

Nick Coghlan added the comment:

Unfortunately, a lot of these things aren't well defined in the docs because 
they're not especially well defined, period. The codecs module works very well 
if you stick to the common, well-tested paths (primarily the text encodings), 
but it's complex enough that there are quite a few dark corners as well.

The functional changes in 3.4 and Martin's documentation updates in issue 19548 
certainly improved things a bit further.

I'm inclined to agree with Marc-Andre's comment on 20132, that we're a bit down 
in the weeds at the moment, without a clear shared vision of where we *want* to 
be for the codecs module. A couple of other big issues with the current design 
of the module are the fact you can't register a codec directly, you have to 
register a search function (which you then can't unregister) and the fact that 
the "is a text encoding" flag I added for 3.4 is private, rather than a 
generally available capability.

In terms of this issue, until Martin's last patch, the error handling 
documentation basically all assumed text codecs. The changes in that patch 
clarified some areas that could be tested with the bytes-bytes codecs, but left 
others still vague because it isn't clear what's intended behaviour, and what's 
an implementation accident in CPython.

I've added MAL to the nosy list here as well, since if anyone is going to know 
the *intended* interaction between error handlers and arbitrary codecs its MAL.

--
nosy: +lemburg

___
Python tracker 

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



[issue4395] Document auto __ne__ generation; provide a use case for non-trivial __ne__

2015-01-24 Thread Nick Coghlan

Nick Coghlan added the comment:

While Martin's patch doesn't cover all the vagaries of comparison operations 
discussed above, it fixes the outright error, and provides an appropriate 
cross-reference to functools.total_ordering.

--

___
Python tracker 

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



[issue22885] Arbitrary code execution vulnerability due to unchecked eval() call in dumbdbm module

2015-01-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I mean that raising dbm.dumb.error is different issue unrelated to changing 
eval to ast.literal_eval. See also Raymond's objections in issue21708.

issue22885.patch LGTM.

--
nosy: +rhettinger

___
Python tracker 

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



[issue22885] Arbitrary code execution vulnerability due to unchecked eval() call in dumbdbm module

2015-01-24 Thread Claudiu Popa

Claudiu Popa added the comment:

Thanks, Serhiy. Only the security issue is fixed in this patch, since eval is 
replaced by ast.literal_eval and nothing else. Indeed, if the data is something 
else than what dbm expects after ast.literal_eval, then it would fail, but it 
would have failed previously too.

--

___
Python tracker 

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



[issue22885] Arbitrary code execution vulnerability due to unchecked eval() call in dumbdbm module

2015-01-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Raising dbm.dumb.error is behavior change. It would be safer not apply this 
part in maintained releases.

If add sanity checks in 3.5, note that following line "key = 
key.encode('Latin-1')" can raise an exception too (AttributeError or 
UnicodeEncodeError). And incorrect data can cause an error later in __getitem__ 
if pos_and_siz_pair is not a pair of two integers.

I think it is worth to split this issue on two issues and fix only security 
issue here.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue3566] httplib persistent connections violate MUST in RFC2616 sec 8.1.4.

2015-01-24 Thread Martin Panter

Martin Panter added the comment:

Here is a patch, including tests and documentation. It ended up a bit more 
complicated than I anticipated, so I’m interested in hearing other ideas or 
options.

* Added http.client.ConnectionClosed exception
* HTTPConnection.close() is implicitly called for a persistent connection 
closure
* BadStatusLine or ConnectionError (rather than new exception) is still raised 
on first getresponse()
* request() raising a ConnectionError does not necessarily mean the server did 
not send a response, so ConnectionClosed is only raised by getresponse()
* ConnectionClosed wraps ECONNRESET from the first recv() of the status line, 
but not after part of the status line has already been received

With this I hope code for making idempotent requests on a persistent connection 
would look a bit like this:

def idempotent_request(connection)
try:
attempt_request(connection, ...)
response = connection.get_response()
if response.status == HTTPStatus.REQUEST_TIMEOUT:
raise ConnectionClosed(response.reason)
except ConnectionClosed:
attempt_request(connection, ...)
response = connection.get_response()
return response

def attempt_request(connection):
try:
connection.request(...)
except ConnectionError:
pass  # Ignore and read server response

--
keywords: +patch
Added file: http://bugs.python.org/file37834/ConnectionClosed.patch

___
Python tracker 

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