[issue25409] fnmatch.fnmatch normalizes slashes/backslashes on Windows

2015-10-15 Thread R. David Murray

R. David Murray added the comment:

I think the existing behavior is the desirable behavior, but in any case as you 
say it is too late to change it.  The docs should indeed be clarified by 
changing the wording to indicate that fnmatch calls normcase but fnmatchcase 
does not, with a link to normcase (which in turn documents the windows 
behavior).

--
nosy: +r.david.murray
stage:  -> needs patch
versions: +Python 3.4, Python 3.6

___
Python tracker 

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



[issue25386] msvcrt_putch/msvcrt_putwch don't check the return value of _putch/_putwch

2015-10-15 Thread Eric V. Smith

Eric V. Smith added the comment:

That's a great test, thanks.

If we were designing this from scratch, I agree that raising an exception is 
the right thing to do. But the questions is: can we change the behavior now?

I think it's unlikely that anyone is relying on these functions returning 
[W]EOF, and that raising an exception is unlikely to cause problems.

I'm curious: did you [Alexander] have some code where you're actually expecting 
an exception, or did you just stumble across this case?

--

___
Python tracker 

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



[issue25402] More accurate estimation of the number of digits in int to decimal string conversion

2015-10-15 Thread R. David Murray

Changes by R. David Murray :


--
title: Accurater estimation of the number of digits in int to decimal string 
conversion -> More accurate estimation of the number of digits in int to 
decimal string conversion

___
Python tracker 

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



[issue25194] Opt-in motivations & affiliations page for core contributors

2015-10-15 Thread Nick Coghlan

Nick Coghlan added the comment:

Additional notes for a revised preamble:

* it may be worth linking to the OpenHub contributor page to highlight the 
automatically generated list of active core contributors, and the fact that 
this page is designed to add the Motivations & Affiliations information that 
can't be readily extracted from existing public data sources

* a cross-link to the Experts Index for technical interests may be useful

* given the current scope limitations, it may be worth changing to "core 
developers" as the terminology, since we're not capturing other forms of 
contribution (e.g. issue triagers and user representatives in mailing list 
design discussions)

--

___
Python tracker 

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



[issue25411] SMTPHandler in the logging module fails with unicode strings

2015-10-15 Thread simon04

New submission from simon04:

This relates to the unresolved issue9208 (Python 2).

SMTPHandler fails when receiving unicode strings.

Example (from msg109621):
import logging,logging.handlers
smtpHandler = logging.handlers.SMTPHandler(
mailhost=("smtp.free.fr",25),
fromaddr="f...@free.fr", toaddrs="t...@free.fr",
subject=u"error message")
LOG = logging.getLogger()
LOG.addHandler(smtpHandler)
LOG.error(u"accentu\u00E9")

… fails:
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.5/logging/handlers.py", line 985, in emit
smtp.sendmail(self.fromaddr, self.toaddrs, msg)
  File "/usr/lib/python3.5/smtplib.py", line 846, in sendmail
msg = _fix_eols(msg).encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 
108: ordinal not in range(128)
Call stack:
  File "/tmp/x.py", line 8, in 
LOG.error(u"accentu\u00E9")
Message: 'accentué'
Arguments: ()

As discussed in msg252928 and msg252931, EmailMessage/send_message should be 
used instead to resolve this issue.

Patch attached.

--
files: SMTPHandler-unicode-v1.patch
keywords: patch
messages: 253043
nosy: simon04
priority: normal
severity: normal
status: open
title: SMTPHandler in the logging module fails with unicode strings
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40787/SMTPHandler-unicode-v1.patch

___
Python tracker 

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



[issue25194] Opt-in motivations & affiliations page for core contributors

2015-10-15 Thread Berker Peksag

Berker Peksag added the comment:

> * it may be worth linking to the OpenHub contributor page to highlight the 
> automatically generated list of active core contributors

+1 but that data is a bit outdated. Perhaps the GitHub mirror can be used as a 
more up-to-date data source: 
https://github.com/python/cpython/graphs/contributors?from=2015-01-01=2016-01-01=c

> * given the current scope limitations, it may be worth changing to "core 
> developers" as the terminology, since we're not capturing other forms of 
> contribution

+1

--
nosy: +berker.peksag

___
Python tracker 

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



[issue22005] datetime.__setstate__ fails decoding python2 pickle

2015-10-15 Thread Christian Tanzer

Christian Tanzer added the comment:

IMNSHO, the problem lies in the Python 3 pickle.py and it is **not** restricted 
to datetime instances 
(for a detailed rambling see 
http://c-tanzer.at/en/breaking_py2_pickles_in_py3.html) .

In Python 2, 8-bit strings are used for text and for binary data. Well designed 
applications will use unicode for all text, but Python 2 itself forces some 
text to be 8-bit string, e.g., names of attributes, classes, and functions. In 
other words, **any 8-bit strings explicitly created by such an application will 
contain binary data.**

In Python 2, pickle.dump uses BINSTRING (and SHORT_BINSTRING) for 8-bit 
strings; Python 3 uses BINBYTES (and SHORT_BINBYTES) instead.

In Python 3, pickle.load should handle BINSTRING (and SHORT_BINSTRING) like 
this:

* convert ASCII values to `str`

* convert non-ASCII values to `bytes`

`bytes` is Python 3's equivalent to Python 2's 8-bit string! 

It is only because of the use of 8-bit strings for Python 2 names that the 
mapping to `str` is necessary but all such names are guaranteed to be ASCII!

I would propose to change `load_binstring` and `load_short_binstring` to call a 
function like::

def _decode_binstring(self, value):
# Used to allow strings from Python 2 to be decoded either as
# bytes or Unicode strings.  This should be used only with the
# BINSTRING and SHORT_BINSTRING opcodes.
if self.encoding != "bytes":
try :
return value.decode("ASCII")
except UnicodeDecodeError:
pass
return value

instead of the currently called `_decode_string`.

--

___
Python tracker 

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



[issue25210] Special-case NoneType() in do_richcompare()

2015-10-15 Thread Ezio Melotti

Ezio Melotti added the comment:

Thanks!

--
stage: patch review -> resolved

___
Python tracker 

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



[issue25410] Clean up and fix OrderedDict

2015-10-15 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch cleans up and fixes minor bugs in C implementation of 
OrderedDict.

1. Used the "p" format unit instead of manual calling PyObject_True() for 
parsing boolean parameters.

2. Used _Py_Identifier private API instead of char* API if appropriate.

3. Used Py_TYPE instead of the __class__ attribute as in other extension types.

4. Fixed od_fast_nodes size calculation in  __sizeof__().

5. Simplified __reduce__() taking into account that __dict__ is empty in C 
implementation of OrderedDict.

6. popitem() with wrong number of arguments now raises TypeError instead of 
KeyError for empty dictionary.

7. Python implementation of move_to_end() calls key comparing only once in 
common case. C implementation called key comparing twice, it first compares a 
key with first or last key. Now C implementation calls key comparing only once 
in common case.

8. Used PyUnicode_FromFormat() instead of str.__mod__ in __repr__().

9. update() now takes into account that args and kwargs are always tuple and 
dict (if not NULL).

10. Got rid of PyMapping_Items() in update(). PyMapping_Items() creates a copy 
of items as a list, this is not needed.

Also applied other cleanups. The size of sources is decreased by 105 lines.

 Objects/odictobject.c |  194 +-!!
 1 file changed, 6 insertions(+), 111 deletions(-), 77 modifications(!)

--
components: Extension Modules
files: odict_cleanup.patch
keywords: patch
messages: 253033
nosy: eric.snow, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Clean up and fix OrderedDict
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40785/odict_cleanup.patch

___
Python tracker 

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



[issue25403] urllib.parse.urljoin is broken in python 3.5

2015-10-15 Thread Wei Wu

Wei Wu added the comment:

It's a change made in 3.5 that resolution of relative URLs confirms to the RFC 
3986. See https://bugs.python.org/issue22118 for details.

--
nosy: +kilowu

___
Python tracker 

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



[issue25403] urllib.parse.urljoin is broken in python 3.5

2015-10-15 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +berker.peksag, martin.panter, orsenthil

___
Python tracker 

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



[issue25403] urllib.parse.urljoin is broken in python 3.5

2015-10-15 Thread STINNER Victor

STINNER Victor added the comment:

See also this change:

changeset:   95683:fc0e79387a3a
user:Berker Peksag 
date:Thu Apr 16 02:31:14 2015 +0300
files:   Lib/test/test_urlparse.py Lib/urllib/parse.py Misc/NEWS
description:
Issue #23703: Fix a regression in urljoin() introduced in 901e4e52b20a.

Patch by Demian Brecht.

--
nosy: +haypo

___
Python tracker 

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



[issue16113] Add SHA-3 (Keccak) support

2015-10-15 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
priority: release blocker -> normal
resolution: fixed -> 
stage: commit review -> 
status: closed -> open
title: SHA-3 (Keccak) support may need to be removed before 3.4 -> Add SHA-3 
(Keccak) support
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue25402] Accurater estimation of the number of digits in int to decimal string conversion

2015-10-15 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue21475] Support the Sitemap extension in robotparser

2015-10-15 Thread Berker Peksag

Berker Peksag added the comment:

issue 25400 is not a blocker of this, so feel free to write a patch.

--

___
Python tracker 

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



[issue25006] List pybind11 binding generator

2015-10-15 Thread Wenzel Jakob

Wenzel Jakob added the comment:

Hi,

just another ping regarding this ticket. Since the last message, pybind11 now 
has:

- Documentation on readthedocs: http://pybind11.readthedocs.org/en/latest/
- Continuous integration tests: https://travis-ci.org/wjakob/pybind11
- A first stable release: https://github.com/wjakob/pybind11/releases

It would be fantastic if the Python documentation referenced it as an option 
for binding C++ code to Python.

Thanks,
Wenzel

--

___
Python tracker 

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



[issue25402] Accurater estimation of the number of digits in int to decimal string conversion

2015-10-15 Thread STINNER Victor

STINNER Victor added the comment:

Currently, the code uses Py_ABS(Py_SIZE(x))*PyLong_SHIFT to estimate the 
upper-bound of the number of bits of the number x. It's a raw estimation, the 
difference can be up to 29 bits. We may try to compute the exact number of 
bits, x.bit_length().

Python 3.5 estimate the number of "decimalbase" (10**9) digits using:

def decimalbase_digits1(x):
bits = size(x) * PyLong_SHIFT
return 1 + bits // (3 * _PyLong_DECIMAL_SHIFT)

I wrote a test to compute how many digits are overallocated (and unused): 
552961 for this function. I'm not sure that "1+" is needed, since 3.0 is 
already lower than log2(10) (3.32...). If we compute the exact number of bits 
using the Python 3.5 function, it's a little bit better:

def decimalbase_digits2(x):
bits = x.bit_length()
return 1 + bits // (3 * _PyLong_DECIMAL_SHIFT)

=> 546250 digits (1% less). You propose a better estimation:

def decimalbase_digits3(x):
digits = size(x)
d = (33 * _PyLong_DECIMAL_SHIFT) // (10 * PyLong_SHIFT - 33 * 
_PyLong_DECIMAL_SHIFT)
return 1 + digits + digits // d

With your estimation, only 504243 are overallocated (9% less than Python 3.5 
function). But why only using 2 digits for log2(10) estimation? We can more 
digits:

def decimalbase_digits4(x):
bits = size(x) * PyLong_SHIFT
return bits * 1 // (33219 * _PyLong_DECIMAL_SHIFT)

=> 491908 digits (11% less)

According to my tests, the best function uses the number of bits and the better 
estimation of log2(10):

def new_decimalbase_digits5(x):
bits = x.bit_length()
return bits * 1 // (33219 * _PyLong_DECIMAL_SHIFT)

=> 483424 digits (13% less)


See attached for my tests.

--
Added file: http://bugs.python.org/file40786/estimate_decimalbase_digits.py

___
Python tracker 

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



[issue25403] urllib.parse.urljoin is broken in python 3.5

2015-10-15 Thread Berker Peksag

Changes by Berker Peksag :


--
keywords: +3.5regression

___
Python tracker 

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



[issue25402] Accurater estimation of the number of digits in int to decimal string conversion

2015-10-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> But why only using 2 digits for log2(10) estimation?

Because the difference between 3 and 3.3 is 10%, and the difference between 3.3 
and exact log2(10) is only 1%. Yes, we can use more digits, but the effect of 
any additional digit is decreased in geometric progression.

If use simple and fast formula that avoids integer multiplication overflow 
"digits + digits // d", the effect of additional precision is virtually 
vanished.

>>> PyLong_SHIFT, _PyLong_DECIMAL_SHIFT = 15, 4
>>> (3 * _PyLong_DECIMAL_SHIFT) // (1 * PyLong_SHIFT - 3 * 
>>> _PyLong_DECIMAL_SHIFT)
4
>>> (33 * _PyLong_DECIMAL_SHIFT) // (10 * PyLong_SHIFT - 33 * 
>>> _PyLong_DECIMAL_SHIFT)
7
>>> (33219 * _PyLong_DECIMAL_SHIFT) // (1 * PyLong_SHIFT - 33219 * 
>>> _PyLong_DECIMAL_SHIFT)
7

>>> PyLong_SHIFT, _PyLong_DECIMAL_SHIFT = 30, 9
>>> (3 * _PyLong_DECIMAL_SHIFT) // (1 * PyLong_SHIFT - 3 * 
>>> _PyLong_DECIMAL_SHIFT)
9
>>> (33 * _PyLong_DECIMAL_SHIFT) // (10 * PyLong_SHIFT - 33 * 
>>> _PyLong_DECIMAL_SHIFT)
99
>>> (332 * _PyLong_DECIMAL_SHIFT) // (100 * PyLong_SHIFT - 332 * 
>>> _PyLong_DECIMAL_SHIFT)
249
>>> (3321 * _PyLong_DECIMAL_SHIFT) // (1000 * PyLong_SHIFT - 3321 * 
>>> _PyLong_DECIMAL_SHIFT)
269
>>> (33219 * _PyLong_DECIMAL_SHIFT) // (1 * PyLong_SHIFT - 33219 * 
>>> _PyLong_DECIMAL_SHIFT)
290
>>> (332192 * _PyLong_DECIMAL_SHIFT) // (10 * PyLong_SHIFT - 332192 * 
>>> _PyLong_DECIMAL_SHIFT)
291
>>> (332192809 * _PyLong_DECIMAL_SHIFT) // (1 * PyLong_SHIFT - 
>>> 332192809 * _PyLong_DECIMAL_SHIFT)
291

The best approximation with minimal denominator is 485/146.

>>> PyLong_SHIFT, _PyLong_DECIMAL_SHIFT = 15, 4
>>> (485 * _PyLong_DECIMAL_SHIFT) // (146 * PyLong_SHIFT - 485 * 
>>> _PyLong_DECIMAL_SHIFT)
7
>>> PyLong_SHIFT, _PyLong_DECIMAL_SHIFT = 30, 9
>>> (485 * _PyLong_DECIMAL_SHIFT) // (146 * PyLong_SHIFT - 485 * 
>>> _PyLong_DECIMAL_SHIFT)
291

--

___
Python tracker 

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



[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-15 Thread Sergey Shashkov

New submission from Sergey Shashkov:

__floordiv__ in module fraction fails with TypeError instead of returning 
NotImplemented when modulo is a class without __rtruediv__ or __mul__.

Code sample:

class Foo(object):
def __rdivmod__(self, other):
return 'rdivmod works'

from fractions import Fraction
a = Fraction(1,1)
b = Foo()
print(divmod(1, b))
print(divmod(a, b))



__divmod__ in Fraction is inherited from class Real (numbers.py):
def __divmod__(self, other):
return (self // other, self % other)

So __floordiv__ and __mod__ are called. 

def __floordiv__(a, b):
"""a // b"""
return math.floor(a / b)

def __mod__(a, b):
"""a % b"""
div = a // b
return a - b * div

__floordiv__ if fractions.py makes a true division, and __mod__ makes 
multiplication.



The following code will fix the problem:


def __divmod__(self, other):
if isinstance(a, numbers.Complex):
return (self // other, self % other)
else:
return NotImplemented

--
components: Library (Lib)
messages: 253046
nosy: ShashkovS
priority: normal
severity: normal
status: open
title: __floordiv__ in module fraction fails with TypeError instead of 
returning NotImplemented
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, 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



[issue25414] Drop unnecessary size limit test from deques on builds with 64-bit numbers

2015-10-15 Thread Raymond Hettinger

New submission from Raymond Hettinger:

The following test can never succeed when PY_SSIZE_T_MAX is 63-bits (as that 
number of allocations would exceed possible time and memory).

#define MAX_DEQUE_LEN (PY_SSIZE_T_MAX - 3*BLOCKLEN)

if (len >= MAX_DEQUE_LEN) {
PyErr_SetString(PyExc_OverflowError,
"cannot add more blocks to the deque");
return NULL;
}

Removing the test saves a recurring block of code through-out the module.  The 
block adds register pressure, triggers an unnecessary memory access and has a 
predictable test-and-jump.

Conditional compilation can leave the test in for builds with size_t under 
64-bits.

--
messages: 253053
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Drop unnecessary size limit test from deques on builds with 64-bit 
numbers
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



[issue25414] Bypass unnecessary size limit test from deques on builds with 64-bit numbers

2015-10-15 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
components: +Extension Modules
keywords: +patch
stage:  -> patch review
title: Drop unnecessary size limit test from deques on builds with 64-bit 
numbers -> Bypass unnecessary size limit test from deques on builds with 64-bit 
numbers
type:  -> performance
Added file: http://bugs.python.org/file40789/deque_limit_test.diff

___
Python tracker 

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



[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-15 Thread STINNER Victor

STINNER Victor added the comment:

Can you please write a patch? See https://docs.python.org/devguide/

--
nosy: +haypo

___
Python tracker 

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



[issue25414] Bypass unnecessary size limit test from deques on builds with 64-bit numbers

2015-10-15 Thread Raymond Hettinger

Changes by Raymond Hettinger :


Added file: http://bugs.python.org/file40790/deque_limit_test.diff

___
Python tracker 

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



[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-15 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue25006] List pybind11 binding generator

2015-10-15 Thread Wenzel Jakob

Wenzel Jakob added the comment:

Dear Antoine,

I wonder if this makes sense, as pybind11 is a collection of C++ header files 
using the Python C API.

The library is meant to be used by other projects but does not generate any 
installable code by itself. (i.e. it isn't clear what pip install pybind11 
should even do) I haven't seen any PyPI packages of this type, though I'm happy 
to be told otherwise.

Best,
Wenzel

--

___
Python tracker 

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



[issue25006] List pybind11 binding generator

2015-10-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

You could perhaps start by creating a PyPI entry for your package:
https://pypi.python.org/pypi?%3Aaction=search=pybind11=search

--
nosy: +pitrou

___
Python tracker 

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



[issue25411] SMTPHandler in the logging module fails with unicode strings

2015-10-15 Thread R. David Murray

R. David Murray added the comment:

This mostly looks good to me, Vinay.

Simon: did you intentionally omit the date header, and if so why?  (The smtp 
server normally adds one, but you can't really depend on that).  Adding it 
would look like:

  msg['Date'] = email.utils.localtime()

(Hmm.  I wonder if send_message should add Date header if there isn't one...)

--
nosy: +vinay.sajip

___
Python tracker 

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



[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-15 Thread Sergey Shashkov

Sergey Shashkov added the comment:

def __floordiv__(a, b):
"""a // b"""
if isinstance(b, numbers.Complex):
return math.floor(a / b)
else:
return NotImplemented

And the same for __mod__.

--

___
Python tracker 

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



[issue25411] SMTPHandler in the logging module fails with unicode strings

2015-10-15 Thread simon04

Changes by simon04 :


--
nosy: +r.david.murray

___
Python tracker 

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



[issue25413] ctypes (libffi) fails to compile on Solaris X86

2015-10-15 Thread Cristi Fati

New submission from Cristi Fati:

2.7.10 regression (at least compared to 2.7.3), not sure which exact version 
between the 2 first introduced it.

Due to addition of `win32.S` in the list build on Solaris X86 (32bit which also 
identifies the platform as X86) fails.

Attaching a patch. After applying it, compiles and runs on Solaris X86 and 
Windowses.

--
components: ctypes
files: Python-2.7.10-ux_x86_libffi.patch
keywords: patch
messages: 253048
nosy: CristiFati
priority: normal
severity: normal
status: open
title: ctypes (libffi) fails to compile on Solaris X86
type: compile error
versions: Python 2.7
Added file: http://bugs.python.org/file40788/Python-2.7.10-ux_x86_libffi.patch

___
Python tracker 

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



[issue25410] Clean up and fix OrderedDict

2015-10-15 Thread Raymond Hettinger

Raymond Hettinger added the comment:

These all look good except for perhaps #5 which I need to look at a bit more 
for its effect on OD subclasses.

--

___
Python tracker 

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



[issue25415] I can create instances of io.IOBase

2015-10-15 Thread Gerrit Holl

Gerrit Holl added the comment:

When the documentation says there is no public constructor, I expected it would 
be impossible to create instances, as in:

TypeError: cannot create 'builtin_function_or_method' instances

Perhaps I misunderstand the documentation.

--

___
Python tracker 

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



[issue25417] Minor typo in Path.samefile docstring

2015-10-15 Thread Antony Lee

New submission from Antony Lee:

The output of pydoc for Path.samefile currently reads

pathlib.Path.samefile = samefile(self, other_path)
Return whether `other_file` is the same or not as this file.
(as returned by os.path.samefile(file, other_file)).

It should arguably be something like

pathlib.Path.samefile = samefile(self, other_path)
Return whether `other_path` is the same or not as this file.
(as returned by os.path.samefile(file, other_file)).

or

pathlib.Path.samefile = samefile(self, other_path)
Return whether `other_path` is the same or not as this file.
(as returned by os.path.samefile(str(self), str(other_path))).

--
components: Library (Lib)
messages: 253066
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: Minor typo in Path.samefile docstring
versions: 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



[issue25417] Minor typo in Path.samefile docstring

2015-10-15 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy:  -ethan.furman

___
Python tracker 

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



[issue25403] urllib.parse.urljoin is broken in python 3.5

2015-10-15 Thread Martin Panter

Martin Panter added the comment:

It is true that 3.5 is meant to follow RFC 3986, which obsoletes RFC 1808 and 
specifies slightly different behaviour for abnormal cases. This change is 
documented under urljoin(), and also in “What’s New in 3.5”. Pavel’s first case 
is one of these differences in the RFCs, and I don’t think it is a bug. 
According to ,

“The remove_dot_segments algorithm respects [the base’s] hierarchy by removing 
extra dot-segments rather than treating them as an error or leaving them to be 
misinterpreted by dereference implementations.”

For Pavel’s second and third cases, RFC 3986 doesn’t cover them directly 
because the base URL is relative. The RFC only covers absolute base URLs, which 
start with a scheme like “http:”. The documentation doesn’t really bless these 
cases either: ‘Construct a full (“absolute”) URL’. However there is explicit 
support in the source code ("" in urllib.parse.uses_relative).

It looks like 3.5 is strict in following the RFC’s Remove Dot Segments 
algorithm. Step 2C says that for “/../” or “/..”, the parent segment is 
removed, but the input is always replaced with “/”:

“a/..” → “/”
“a/../..” → “/..” → “/”

I would prefer a less strict interpretation of the spirit of the algorithm. Do 
not introduce a slash in the input if you did not remove one from the output 
buffer:

“a/..” → empty URL
“a/../..” → “..” → empty URL

Python 3.4 and earlier did not behave sensibly if you extend the relative URL:

>>> urljoin("a/", "..")
''
>>> urljoin("a/", "../..")
'..'
>>> urljoin("a/", "../../..")
''
>>> urljoin("a/", "../../../..")
'../'

Pavel, what behaviour would you expect in these cases? My empty URL 
interpretation, or perhaps a more sensible version of the Python 3.4 behaviour? 
What is your use case?

One related more serious (IMO) regression I noticed compared to 3.4, where the 
path becomes a host name:

>>> urljoin("file:///base", "/dummy/..//host/oops")
'file://host/oops'

--
components:  -Interpreter Core

___
Python tracker 

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



[issue25417] Minor typo in Path.samefile docstring

2015-10-15 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

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



[issue21475] Support the Sitemap extension in robotparser

2015-10-15 Thread Peter Wirtz

Peter Wirtz added the comment:

Here is a patch that provides support for the Sitemap extension.

--
keywords: +patch
Added file: http://bugs.python.org/file40791/robotparser_site_maps_v1.patch

___
Python tracker 

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



[issue25415] I can create instances of io.IOBase

2015-10-15 Thread Martin Panter

Martin Panter added the comment:

“No public constructor” to me means that it is not defined how or if you can 
construct instances other than by the public subclasses. What do you expect to 
happen? How do you expect the public subclasses such as FileIO and 
BufferedReader to work if the base constructor does not work?

The other three base classes (RawIOBase, BufferedIOBase, TextIOBase) also say 
“there is no public constructor”. However allowing custom subclasses of these 
is very useful, so I would actually be for removing these restrictions from the 
documentation, and instead saying that each constructor accepts no arguments.

--
assignee:  -> docs@python
components: +Documentation, IO -Library (Lib)
nosy: +docs@python, martin.panter

___
Python tracker 

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



[issue25409] fnmatch.fnmatch normalizes slashes/backslashes on Windows

2015-10-15 Thread Florian Bruhin

New submission from Florian Bruhin:

On Windows 8:

>>> fnmatch.fnmatch(r'foo\bar', 'foo/bar')
True
>>> fnmatch.fnmatchcase(r'foo\bar', 'foo/bar')
False

This is due to fnmatch calling os.path.normpath on the arguments (to get the 
case-sensitivity of the filesystem), which on Windows *also* happens to 
normalize / to \.

It's probably a bad idea to change the behaviour now, but I think at least this 
should be clarified in the docs.

--
components: Library (Lib)
messages: 253030
nosy: The Compiler, eric.araujo, ezio.melotti, georg.brandl, paul.moore, 
steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: fnmatch.fnmatch normalizes slashes/backslashes on Windows
type: behavior
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue25416] Add encoding aliases from the (HTML5) Encoding Standard

2015-10-15 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Unicode
nosy: +ezio.melotti, haypo, lemburg, loewis
stage:  -> needs patch
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