[issue22486] Add math.gcd()

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is fixed patch.

There was integer overflow. In C short*short is extended to int, but int*int 
results int.

--
Added file: http://bugs.python.org/file36741/lehmer_gcd_7.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22486
___diff -r e9d4288c32de Doc/library/math.rst
--- a/Doc/library/math.rst  Wed Sep 24 13:29:27 2014 +0300
+++ b/Doc/library/math.rst  Sat Sep 27 11:09:15 2014 +0300
@@ -100,6 +100,14 @@ Number-theoretic and representation func
http://code.activestate.com/recipes/393090/`_\.
 
 
+.. function:: gcd(a, b)
+
+   Return the greatest common divisor of the integers *a* and *b*.  If either
+   *a* or *b* is nonzero, then the value of ``gcd(a, b)`` is the largest
+   positive integer that divides both *a* and *b*.  ``gcd(0, 0)`` returns
+   ``0``.
+
+
 .. function:: isfinite(x)
 
Return ``True`` if *x* is neither an infinity nor a NaN, and
diff -r e9d4288c32de Include/longobject.h
--- a/Include/longobject.h  Wed Sep 24 13:29:27 2014 +0300
+++ b/Include/longobject.h  Sat Sep 27 11:09:15 2014 +0300
@@ -198,6 +198,9 @@ PyAPI_FUNC(int) _PyLong_FormatAdvancedWr
 PyAPI_FUNC(unsigned long) PyOS_strtoul(const char *, char **, int);
 PyAPI_FUNC(long) PyOS_strtol(const char *, char **, int);
 
+/* For use by the gcd function in mathmodule.c */
+PyAPI_FUNC(PyObject *) _PyLong_GCD(PyObject *, PyObject *);
+
 #ifdef __cplusplus
 }
 #endif
diff -r e9d4288c32de Lib/fractions.py
--- a/Lib/fractions.py  Wed Sep 24 13:29:27 2014 +0300
+++ b/Lib/fractions.py  Sat Sep 27 11:09:15 2014 +0300
@@ -174,9 +174,12 @@ class Fraction(numbers.Rational):
 if denominator == 0:
 raise ZeroDivisionError('Fraction(%s, 0)' % numerator)
 if _normalize:
-g = gcd(numerator, denominator)
+g = math.gcd(numerator, denominator)
 numerator //= g
 denominator //= g
+if denominator  0:
+numerator = -numerator
+denominator = -denominator
 self._numerator = numerator
 self._denominator = denominator
 return self
diff -r e9d4288c32de Lib/test/test_math.py
--- a/Lib/test/test_math.py Wed Sep 24 13:29:27 2014 +0300
+++ b/Lib/test/test_math.py Sat Sep 27 11:09:15 2014 +0300
@@ -595,6 +595,45 @@ class MathTests(unittest.TestCase):
 s = msum(vals)
 self.assertEqual(msum(vals), math.fsum(vals))
 
+def testGcd(self):
+gcd = math.gcd
+self.assertEqual(gcd(0, 0), 0)
+self.assertEqual(gcd(1, 0), 1)
+self.assertEqual(gcd(-1, 0), 1)
+self.assertEqual(gcd(0, 1), 1)
+self.assertEqual(gcd(0, -1), 1)
+self.assertEqual(gcd(7, 1), 1)
+self.assertEqual(gcd(7, -1), 1)
+self.assertEqual(gcd(-23, 15), 1)
+self.assertEqual(gcd(120, 84), 12)
+self.assertEqual(gcd(84, -120), 12)
+self.assertEqual(gcd(1216342683557601535506311712,
+ 436522681849110124616458784), 32)
+c = 652560
+x = 434610456570399902378880679233098819019853229470286994367836600566
+y = 1064502245825115327754847244914921553977
+a = x * c
+b = y * c
+self.assertEqual(gcd(a, b), c)
+self.assertEqual(gcd(b, a), c)
+self.assertEqual(gcd(-a, b), c)
+self.assertEqual(gcd(b, -a), c)
+self.assertEqual(gcd(a, -b), c)
+self.assertEqual(gcd(-b, a), c)
+self.assertEqual(gcd(-a, -b), c)
+self.assertEqual(gcd(-b, -a), c)
+c = 576559230871654959816130551884856912003141446781646602790216406874
+a = x * c
+b = y * c
+self.assertEqual(gcd(a, b), c)
+self.assertEqual(gcd(b, a), c)
+self.assertEqual(gcd(-a, b), c)
+self.assertEqual(gcd(b, -a), c)
+self.assertEqual(gcd(a, -b), c)
+self.assertEqual(gcd(-b, a), c)
+self.assertEqual(gcd(-a, -b), c)
+self.assertEqual(gcd(-b, -a), c)
+
 def testHypot(self):
 self.assertRaises(TypeError, math.hypot)
 self.ftest('hypot(0,0)', math.hypot(0,0), 0)
diff -r e9d4288c32de Modules/mathmodule.c
--- a/Modules/mathmodule.c  Wed Sep 24 13:29:27 2014 +0300
+++ b/Modules/mathmodule.c  Sat Sep 27 11:09:15 2014 +0300
@@ -656,6 +656,22 @@ m_log10(double x)
 }
 
 
+static PyObject *
+math_gcd(PyObject *self, PyObject *args)
+{
+PyObject *a, *b;
+
+if (!PyArg_ParseTuple(args, O!O!:gcd, PyLong_Type, a, PyLong_Type, 
b))
+return NULL;
+
+return _PyLong_GCD(a, b);
+}
+
+PyDoc_STRVAR(math_gcd_doc,
+gcd(x, y) - int\n\
+greatest common divisor of x and y);
+
+
 /* Call is_error when errno != 0, and where x is the result libm
  * returned.  is_error will usually set up an exception and return
  * true (1), but may return false (0) without setting up an exception.
@@ -1958,6 +1974,7 @@ static 

[issue22486] Add math.gcd()

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And for comparison here is simpler patch with Euclidean algorithm.

--
Added file: http://bugs.python.org/file36742/euclidean_gcd.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22486
___diff -r e9d4288c32de Doc/library/math.rst
--- a/Doc/library/math.rst  Wed Sep 24 13:29:27 2014 +0300
+++ b/Doc/library/math.rst  Fri Sep 26 21:37:23 2014 +0300
@@ -100,6 +100,14 @@ Number-theoretic and representation func
http://code.activestate.com/recipes/393090/`_\.
 
 
+.. function:: gcd(a, b)
+
+   Return the greatest common divisor of the integers *a* and *b*.  If either
+   *a* or *b* is nonzero, then the value of ``gcd(a, b)`` is the largest
+   positive integer that divides both *a* and *b*.  ``gcd(0, 0)`` returns
+   ``0``.
+
+
 .. function:: isfinite(x)
 
Return ``True`` if *x* is neither an infinity nor a NaN, and
diff -r e9d4288c32de Include/longobject.h
--- a/Include/longobject.h  Wed Sep 24 13:29:27 2014 +0300
+++ b/Include/longobject.h  Fri Sep 26 21:37:23 2014 +0300
@@ -198,6 +198,9 @@ PyAPI_FUNC(int) _PyLong_FormatAdvancedWr
 PyAPI_FUNC(unsigned long) PyOS_strtoul(const char *, char **, int);
 PyAPI_FUNC(long) PyOS_strtol(const char *, char **, int);
 
+/* For use by the gcd function in mathmodule.c */
+PyAPI_FUNC(PyObject *) _PyLong_GCD(PyObject *, PyObject *);
+
 #ifdef __cplusplus
 }
 #endif
diff -r e9d4288c32de Lib/fractions.py
--- a/Lib/fractions.py  Wed Sep 24 13:29:27 2014 +0300
+++ b/Lib/fractions.py  Sat Sep 27 11:09:15 2014 +0300
@@ -174,9 +174,12 @@ class Fraction(numbers.Rational):
 if denominator == 0:
 raise ZeroDivisionError('Fraction(%s, 0)' % numerator)
 if _normalize:
-g = gcd(numerator, denominator)
+g = math.gcd(numerator, denominator)
 numerator //= g
 denominator //= g
+if denominator  0:
+numerator = -numerator
+denominator = -denominator
 self._numerator = numerator
 self._denominator = denominator
 return self
diff -r e9d4288c32de Lib/test/test_math.py
--- a/Lib/test/test_math.py Wed Sep 24 13:29:27 2014 +0300
+++ b/Lib/test/test_math.py Sat Sep 27 11:09:15 2014 +0300
@@ -595,6 +595,45 @@ class MathTests(unittest.TestCase):
 s = msum(vals)
 self.assertEqual(msum(vals), math.fsum(vals))
 
+def testGcd(self):
+gcd = math.gcd
+self.assertEqual(gcd(0, 0), 0)
+self.assertEqual(gcd(1, 0), 1)
+self.assertEqual(gcd(-1, 0), 1)
+self.assertEqual(gcd(0, 1), 1)
+self.assertEqual(gcd(0, -1), 1)
+self.assertEqual(gcd(7, 1), 1)
+self.assertEqual(gcd(7, -1), 1)
+self.assertEqual(gcd(-23, 15), 1)
+self.assertEqual(gcd(120, 84), 12)
+self.assertEqual(gcd(84, -120), 12)
+self.assertEqual(gcd(1216342683557601535506311712,
+ 436522681849110124616458784), 32)
+c = 652560
+x = 434610456570399902378880679233098819019853229470286994367836600566
+y = 1064502245825115327754847244914921553977
+a = x * c
+b = y * c
+self.assertEqual(gcd(a, b), c)
+self.assertEqual(gcd(b, a), c)
+self.assertEqual(gcd(-a, b), c)
+self.assertEqual(gcd(b, -a), c)
+self.assertEqual(gcd(a, -b), c)
+self.assertEqual(gcd(-b, a), c)
+self.assertEqual(gcd(-a, -b), c)
+self.assertEqual(gcd(-b, -a), c)
+c = 576559230871654959816130551884856912003141446781646602790216406874
+a = x * c
+b = y * c
+self.assertEqual(gcd(a, b), c)
+self.assertEqual(gcd(b, a), c)
+self.assertEqual(gcd(-a, b), c)
+self.assertEqual(gcd(b, -a), c)
+self.assertEqual(gcd(a, -b), c)
+self.assertEqual(gcd(-b, a), c)
+self.assertEqual(gcd(-a, -b), c)
+self.assertEqual(gcd(-b, -a), c)
+
 def testHypot(self):
 self.assertRaises(TypeError, math.hypot)
 self.ftest('hypot(0,0)', math.hypot(0,0), 0)
diff -r e9d4288c32de Modules/mathmodule.c
--- a/Modules/mathmodule.c  Wed Sep 24 13:29:27 2014 +0300
+++ b/Modules/mathmodule.c  Fri Sep 26 21:37:23 2014 +0300
@@ -656,6 +656,22 @@ m_log10(double x)
 }
 
 
+static PyObject *
+math_gcd(PyObject *self, PyObject *args)
+{
+PyObject *a, *b;
+
+if (!PyArg_ParseTuple(args, O!O!:gcd, PyLong_Type, a, PyLong_Type, 
b))
+return NULL;
+
+return _PyLong_GCD(a, b);
+}
+
+PyDoc_STRVAR(math_gcd_doc,
+gcd(x, y) - int\n\
+greatest common divisor of x and y);
+
+
 /* Call is_error when errno != 0, and where x is the result libm
  * returned.  is_error will usually set up an exception and return
  * true (1), but may return false (0) without setting up an exception.
@@ -1958,6 +1974,7 @@ static PyMethodDef math_methods[] = {
 {frexp, 

[issue20267] TemporaryDirectory does not resolve path when created using a relative path

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Note that abspath() can return incorrect result in case of symbolic links to 
directories and pardir components. I.e. abspath('symlink/..').

--

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



[issue20267] TemporaryDirectory does not resolve path when created using a relative path

2014-09-27 Thread Serhiy Storchaka

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


--
nosy: +pitrou

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



[issue22502] Ctl-C after continue in pdb stops in signal.py

2014-09-27 Thread Xavier de Gaye

New submission from Xavier de Gaye:

With the following script:

import time

def foo():
import pdb; pdb.set_trace()
while 1:
time.sleep(.5)

foo()



Hitting ^C after continue gives:

$ ./python foo.py
 foo.py(5)foo()
- while 1:
(Pdb) continue
^C
Program interrupted. (Use 'cont' to resume).
--Call--
 Lib/signal.py(51)signal()
- @_wraps(_signal.signal)
(Pdb)



This is fixed with the following change:

diff --git a/Lib/pdb.py b/Lib/pdb.py
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -186,9 +186,9 @@
 raise KeyboardInterrupt
 self.message(\nProgram interrupted. (Use 'cont' to resume).)
 self.set_step()
-self.set_trace(frame)
 # restore previous signal handler
 signal.signal(signal.SIGINT, self._previous_sigint_handler)
+self.set_trace(frame)

 def reset(self):
 bdb.Bdb.reset(self)

--
components: Library (Lib)
messages: 227666
nosy: georg.brandl, xdegaye
priority: normal
severity: normal
status: open
title: Ctl-C after continue in pdb stops in signal.py
type: behavior
versions: Python 3.5

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



[issue21883] relpath: Provide better errors when mixing bytes and strings

2014-09-27 Thread Serhiy Storchaka

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


--
assignee:  - serhiy.storchaka
nosy: +serhiy.storchaka
stage:  - patch review
versions: +Python 3.5 -Python 3.4

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



[issue22503] Signal stack overflow in faulthandler_user

2014-09-27 Thread Andreas Schwab

New submission from Andreas Schwab:

test_register_chain fails on aarch64 due to signal stack overflow, when 
re-raising the signal in faulthandler_user.  The problem is that the signal 
stack can only handle a single signal frame, but faulthandler_user adds a 
second one.  _Py_Faulthandler_Init should allocate twice the amount of stack to 
cater for the two signal frames.

==
FAIL: test_register_chain (test.test_faulthandler.FaultHandlerTests)
--
Traceback (most recent call last):
  File 
/home/abuild/rpmbuild/BUILD/Python-3.4.1/Lib/test/test_faulthandler.py, line 
592, in test_register_chain
self.check_register(chain=True)
  File 
/home/abuild/rpmbuild/BUILD/Python-3.4.1/Lib/test/test_faulthandler.py, line 
576, in check_register
self.assertEqual(exitcode, 0)
AssertionError: -11 != 0

--

--
components: Extension Modules
messages: 227667
nosy: schwab
priority: normal
severity: normal
status: open
title: Signal stack overflow in faulthandler_user
type: resource usage
versions: Python 3.4

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



[issue21883] relpath: Provide better errors when mixing bytes and strings

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Error message for posixpath.join() was fixed and enhanced in issue22034. Here 
is a patch which extends this enhancement to relpath() and to other os.path 
implementations (ntpath and macpath).

--
Added file: http://bugs.python.org/file36743/os_path_typeerrors.patch

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



[issue15986] memoryview: expose 'buf' attribute

2014-09-27 Thread Stefan Krah

Stefan Krah added the comment:

Sometimes I've used memoryview slices to model pointers in C code.

memoryview could have limited number methods for pointer arithmetic on the
buf pointer. Arithmetic would return new slices, so in fact everything would
be safe with respect to bounds checking and life-cycle management.


Not completely safe of course once you pass the pointer to ctypes, but
the following is less likely to happen:

m = memoryview(b123)
ptr = m.buf
del m
my_ctypes_func(ptr)


This is safer, since the view itself is the pointer:

m = memoryview(b123)
my_ctypes_func(m)


Of course you could still subvert the second idiom by using ptr = int(m).

--

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



[issue22486] Add math.gcd()

2014-09-27 Thread Stefan Behnel

Stefan Behnel added the comment:

Patch 7 works for me. Why are the two Py_ABS() calls at the end needed when we 
start off the algorithm with long_abs()?

The Lehmer code is complex (I guess that's why you added the pure Euclidean 
implementation), but it's the right algorithm to use here, so I'd say we 
should. It's 4% faster than the Euclidean code for the fractions benchmark when 
using 30 bit digits, but (surprisingly enough) about the same speed with 15 bit 
digits. There is no major difference to expect here as the numbers are 
perpetually normalised in Fractions and thus kept small (usually small enough 
to fit into a 64bit integer), i.e. Euclid should do quite well on them.

The difference for big numbers is substantial though:

Euclid:

$ ./python -m timeit -s 'from math import gcd; a = 2**123 + 3**653 + 5**23 + 
7**49; b = 2**653 + 2**123 + 5**23 + 11**34' 'gcd(a,b)'
1 loops, best of 3: 71 usec per loop

Lehmer:

$ ./python -m timeit -s 'from math import gcd; a = 2**123 + 3**653 + 5**23 + 
7**49; b = 2**653 + 2**123 + 5**23 + 11**34' 'gcd(a,b)'
10 loops, best of 3: 11.6 usec per loop

--

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



[issue21883] relpath: Provide better errors when mixing bytes and strings

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ah, tests fail when Python runs without the -bb option.  Here is fixed path.

--
Added file: http://bugs.python.org/file36744/os_path_typeerrors_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21883
___diff -r d43d4d4ebf2c Lib/genericpath.py
--- a/Lib/genericpath.pySat Sep 27 00:57:29 2014 +0300
+++ b/Lib/genericpath.pySat Sep 27 15:52:32 2014 +0300
@@ -130,3 +130,16 @@ def _splitext(p, sep, altsep, extsep):
 filenameIndex += 1
 
 return p, p[:0]
+
+def _check_arg_types(funcname, *args):
+hasstr = hasbytes = False
+for s in args:
+if isinstance(s, str):
+hasstr = True
+elif isinstance(s, bytes):
+hasbytes = True
+else:
+raise TypeError('%s() argument must be str or bytes, not %r' %
+(funcname, s.__class__.__name__)) from None
+if hasstr and hasbytes:
+raise TypeError(Can't mix strings and bytes in path components) from 
None
diff -r d43d4d4ebf2c Lib/macpath.py
--- a/Lib/macpath.pySat Sep 27 00:57:29 2014 +0300
+++ b/Lib/macpath.pySat Sep 27 15:52:32 2014 +0300
@@ -50,20 +50,24 @@ def isabs(s):
 
 
 def join(s, *p):
-colon = _get_colon(s)
-path = s
-for t in p:
-if (not s) or isabs(t):
-path = t
-continue
-if t[:1] == colon:
-t = t[1:]
-if colon not in path:
-path = colon + path
-if path[-1:] != colon:
-path = path + colon
-path = path + t
-return path
+try:
+colon = _get_colon(s)
+path = s
+for t in p:
+if (not s) or isabs(t):
+path = t
+continue
+if t[:1] == colon:
+t = t[1:]
+if colon not in path:
+path = colon + path
+if path[-1:] != colon:
+path = path + colon
+path = path + t
+return path
+except (TypeError, AttributeError, BytesWarning):
+genericpath._check_arg_types('join', s, *p)
+raise
 
 
 def split(s):
diff -r d43d4d4ebf2c Lib/ntpath.py
--- a/Lib/ntpath.py Sat Sep 27 00:57:29 2014 +0300
+++ b/Lib/ntpath.py Sat Sep 27 15:52:32 2014 +0300
@@ -80,32 +80,36 @@ def join(path, *paths):
 sep = '\\'
 seps = '\\/'
 colon = ':'
-result_drive, result_path = splitdrive(path)
-for p in paths:
-p_drive, p_path = splitdrive(p)
-if p_path and p_path[0] in seps:
-# Second path is absolute
-if p_drive or not result_drive:
-result_drive = p_drive
-result_path = p_path
-continue
-elif p_drive and p_drive != result_drive:
-if p_drive.lower() != result_drive.lower():
-# Different drives = ignore the first path entirely
-result_drive = p_drive
+try:
+result_drive, result_path = splitdrive(path)
+for p in paths:
+p_drive, p_path = splitdrive(p)
+if p_path and p_path[0] in seps:
+# Second path is absolute
+if p_drive or not result_drive:
+result_drive = p_drive
 result_path = p_path
 continue
-# Same drive in different case
-result_drive = p_drive
-# Second path is relative to the first
-if result_path and result_path[-1] not in seps:
-result_path = result_path + sep
-result_path = result_path + p_path
-## add separator between UNC and non-absolute path
-if (result_path and result_path[0] not in seps and
-result_drive and result_drive[-1:] != colon):
-return result_drive + sep + result_path
-return result_drive + result_path
+elif p_drive and p_drive != result_drive:
+if p_drive.lower() != result_drive.lower():
+# Different drives = ignore the first path entirely
+result_drive = p_drive
+result_path = p_path
+continue
+# Same drive in different case
+result_drive = p_drive
+# Second path is relative to the first
+if result_path and result_path[-1] not in seps:
+result_path = result_path + sep
+result_path = result_path + p_path
+## add separator between UNC and non-absolute path
+if (result_path and result_path[0] not in seps and
+result_drive and result_drive[-1:] != colon):
+return result_drive + sep + result_path
+return result_drive + result_path
+except (TypeError, AttributeError, BytesWarning):
+genericpath._check_arg_types('join', path, *paths)
+raise
 
 
 # Split a path in a 

[issue22486] Add math.gcd()

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Why are the two Py_ABS() calls at the end needed when we start off the
 algorithm with long_abs()?

Because long_abs()'s are omitted for small enough numbers (common case). So we 
avoid a copying for negative numbers or int subclasses.

 I guess that's why you added the pure Euclidean implementation

Euclidean algorithm is required step at the end of Lehmer algorithm.

 It's 4% faster than the Euclidean code for the fractions benchmark
 when using 30 bit digits, but (surprisingly enough) about the same speed
 with 15 bit digits.

May be because Lehmer code uses 64-bit computation for 30-bit digits, and 
Euclidean code always uses 32-bit computation.

 The difference for big numbers is substantial though:

1000-bit integers are big, but can be encountered in real word (e.g. in 
cryptography). So may be there is need in Lehmer algorithm.

--

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



[issue9393] shelve.open/bsddb.hashopen exception with unicode paths

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

dbm_open_unicode-32.patch no longer applied cleanly due to Argument Clinic.

I'm not sure about applying patches to 2.7. I support this, but it looks as new 
feature, and you should ask on Python-Dev mailing list.

--
nosy: +serhiy.storchaka

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



[issue19569] Use __attribute__((deprecated)) to warn usage of deprecated functions and macros

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Idea looks good to me.

--
components: +Interpreter Core
nosy: +serhiy.storchaka
type:  - enhancement
versions: +Python 3.5 -Python 3.4

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



[issue20021] modernize makeopcodetargets.py

2014-09-27 Thread Serhiy Storchaka

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


--
keywords: +easy
stage:  - needs patch

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



[issue20335] bytes constructor accepts more than one argument even if the first one is not a string

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. Do you want to provide a test Renaud?

--
assignee:  - serhiy.storchaka
nosy: +serhiy.storchaka
stage:  - test needed
type:  - behavior
versions: +Python 2.7, Python 3.4, Python 3.5 -Python 3.3

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



[issue19569] Use __attribute__((deprecated)) to warn usage of deprecated functions and macros

2014-09-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Does the __attribute__ work for macros as well?

--
nosy: +pitrou

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



[issue17174] Posix os.path.join should raise TypeError when passed unusable type

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Fixed in issue22034. See also issue21883.

--
nosy: +serhiy.storchaka
resolution:  - out of date
stage:  - resolved
status: open - closed

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



[issue22504] Add ordering between `Enum` objects

2014-09-27 Thread Ram Rachum

New submission from Ram Rachum:

I suggest making Enum members orderable, according to their order in the enum 
type. Currently trying to order them raises an exception:

 import enum
 class Number(enum.Enum):
... one = 1
... two = 2
... three = 3
 sorted((Number.one, Number.two))
Traceback (most recent call last):
  File pyshell#2, line 1, in module
sorted((Number.one, Number.two))
TypeError: unorderable types: Number()  Number()

If there's agreement from core developers that this is a good feature to add, 
I'll write a patch.

--
components: Library (Lib)
messages: 227678
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Add ordering between `Enum` objects
type: enhancement
versions: Python 3.5

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



[issue20164] Undocumented KeyError from os.path.expanduser

2014-09-27 Thread Serhiy Storchaka

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


--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python
stage:  - needs patch
versions: +Python 3.5 -Python 3.3

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



[issue15414] os.path.join behavior on Windows (ntpath.join) is unexpected and not well documented

2014-09-27 Thread Serhiy Storchaka

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


--
keywords: +needs review
stage:  - patch review
versions: +Python 2.7

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



[issue19569] Use __attribute__((deprecated)) to warn usage of deprecated functions and macros

2014-09-27 Thread Ezio Melotti

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


--
nosy: +ezio.melotti

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



[issue22505] Expose an Enum object's serial number

2014-09-27 Thread Ram Rachum

New submission from Ram Rachum:

I'd like Enum objects to expose their serial numbers. Currently it seems the 
only way to get this is `MyEnum._member_names_.index(my_enum.name)`, which is 
not cool because it's cumbersome and involves private variables.

Perhaps we can use `int(my_enum) == 7`? Or `my_enum.number == 7`? I'll be happy 
to make a patch if there's agreement about this.

--
components: Library (Lib)
messages: 227679
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Expose an Enum object's serial number
type: enhancement
versions: Python 3.5

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



[issue1669539] Add os.path.isrelative() and improve ntpath.isabs()

2014-09-27 Thread Serhiy Storchaka

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


--
title: Improve Windows os.path.join (ntpath.join) smart joining - Add 
os.path.isrelative() and improve ntpath.isabs()
versions: +Python 3.5 -Python 3.4

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



[issue21301] pathlib missing Path.expandvars(env=os.environ)

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

expandvars() works with string, not with path, and I don't think there is a 
place for it in pathlib.

--
nosy: +serhiy.storchaka

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



[issue22505] Expose an Enum object's serial number

2014-09-27 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +barry, eli.bendersky, ethan.furman

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



[issue22506] `dir` on Enum subclass doesn't expose parent class attributes

2014-09-27 Thread Ram Rachum

New submission from Ram Rachum:

Calling `dir` on an enum subclass shows only the contents of that class, not 
its parent classes. In normal classes, you can do this: 

Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 
bit (AMD64)] on win32
Type help, copyright, credits or license for more information.
 class A:
...   x = lambda self: 7
...
 class B(a): pass
...
 assert 'x' in dir(B)

But in enum subclasses, it fails:

 import enum
 class A(enum.Enum):
...   x = lambda self: 7
...
 class B(A):
...   pass
...
 assert 'x' in dir(B)
Traceback (most recent call last):
  File stdin, line 1, in module
AssertionError


Looks like the `__dir__` implementation needs to be tweaked.

--
components: Library (Lib)
messages: 227681
nosy: cool-RR
priority: normal
severity: normal
status: open
title: `dir` on Enum subclass doesn't expose parent class attributes
type: behavior
versions: Python 3.4

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



[issue22505] Expose an Enum object's serial number

2014-09-27 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Sep 27, 2014, at 02:40 PM, Ram Rachum wrote:

I'd like Enum objects to expose their serial numbers.

Can you please provide some motivating use cases?

--

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



[issue22505] Expose an Enum object's serial number

2014-09-27 Thread Ram Rachum

Ram Rachum added the comment:

Right now I want it for this: 

http://bugs.python.org/issue22504

Another use case I can think of is that if you store enum values in a database, 
you're probably using an int field and you'd want to easily convert between an 
enum and it's int value.

--

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



[issue22504] Add ordering between `Enum` objects

2014-09-27 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Sep 27, 2014, at 02:28 PM, Ram Rachum wrote:

I suggest making Enum members orderable, according to their order in the enum
type.

Can you please provide a motivating use case?

--
nosy: +barry

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



[issue18855] Inconsistent README filenames

2014-09-27 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
keywords: +easy
stage:  - needs patch
versions: +Python 3.5 -Python 3.4

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



[issue22504] Add ordering between `Enum` objects

2014-09-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Why don't you use IntEnum?

--
nosy: +pitrou

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



[issue22504] Add ordering between `Enum` objects

2014-09-27 Thread Ram Rachum

Ram Rachum added the comment:

Just because I want to be able to get the `int` value of an enum object, 
doesn't mean I want the enum object to *be* an `int`, which is what `IntEnum` 
means. I don't want it to be comparable to an int, I don't want to use 
arithmetic on it, and most importantly I don't want it to be equal to an enum 
object of a different type that happens to have the same int.

--

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



[issue9850] obsolete macpath module dangerously broken and should be removed

2014-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2ae2ca9d2b66 by Serhiy Storchaka in branch '2.7':
Issue #9850: Fixed macpath.join() for empty first component.  Patch by
https://hg.python.org/cpython/rev/2ae2ca9d2b66

New changeset 54987723de99 by Serhiy Storchaka in branch '3.4':
Issue #9850: Fixed macpath.join() for empty first component.  Patch by
https://hg.python.org/cpython/rev/54987723de99

New changeset e29866cb6b98 by Serhiy Storchaka in branch 'default':
Issue #9850: Fixed macpath.join() for empty first component.  Patch by
https://hg.python.org/cpython/rev/e29866cb6b98

--
nosy: +python-dev

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



[issue22504] Add ordering between `Enum` objects

2014-09-27 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Sep 27, 2014, at 03:35 PM, Ram Rachum wrote:

Just because I want to be able to get the `int` value of an enum object,
doesn't mean I want the enum object to *be* an `int`, which is what `IntEnum`
means. I don't want it to be comparable to an int, I don't want to use
arithmetic on it, and most importantly I don't want it to be equal to an enum
object of a different type that happens to have the same int.

Okay, but that still doesn't explain the use case.  Also, why wouldn't an Enum
subclass, possibly using the ordered dictionary __members__ would not be
sufficient.

--

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



[issue22503] Signal stack overflow in faulthandler_user

2014-09-27 Thread R. David Murray

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


--
nosy: +haypo

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



[issue9850] obsolete macpath module dangerously broken and should be removed

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Committed macpath_join_fix_with_test.patch with some additional tests. Thank 
you for your contribution Oleg.

Needed a patch for deprecating all module or some functions.

--
nosy: +serhiy.storchaka
stage: commit review - needs patch
type: behavior - enhancement
versions:  -Python 2.7

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



[issue22504] Add ordering between `Enum` objects

2014-09-27 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

https://docs.python.org/3/library/enum.html#orderedenum

--

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



[issue22496] urllib2 fails against IIS (urllib2 can't parse 401 reply www-authenticate headers)

2014-09-27 Thread Daniel Holth

Daniel Holth added the comment:

I am not the copyright holder, I only maintain the pypi package for
python-ntlm. I might have 10 lines of my own code in the whole package.

If running on Windows it would be great to have out of the box native
windows NTLM which can be done somehow with the win32 module, I
think...

It may also be possible to use Kerberos authentication (NTLMv2) instead
of NTLM in most cases these days; since after Windows 2000 according to
Wikipedia.

On Fri, Sep 26, 2014, at 01:51 AM, Senthil Kumaran wrote:
 
 Senthil Kumaran added the comment:
 
 Yes, urllib2 does not have any support for NTML based authentication. 
 And it is a long pending feature request too.
 
 For 2.7, the best way to handle this might be, instead of crashing on
 WWW-Authenticate: Negotiate, which is a valid response from IIS (1). It
 should detect it and fail with a helpful message to use a 3rdparty
 handler along with urllib2 [2]
 
 And for 3.5, I think it is worthy to consider adding the support in
 stdlib.
 @Daniel Holth - I see you are the owner of it. If we choose to adopt it,
 do you give permission to reuse portions of code (with correct
 attribution) in the stdlib?
 
 1) http://msdn.microsoft.com/en-us/library/ms995330#http-sso-2_topic1
 2) https://code.google.com/p/python-ntlm/
 
 --
 assignee:  - orsenthil
 nosy: +dholth
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue22496
 ___

--

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



[issue22505] Expose an Enum object's serial number

2014-09-27 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Sep 27, 2014, at 02:59 PM, Ram Rachum wrote:

Right now I want it for this: 

http://bugs.python.org/issue22504

https://docs.python.org/3/library/enum.html#orderedenum

Another use case I can think of is that if you store enum values in a
database, you're probably using an int field and you'd want to easily convert
between an enum and it's int value.

Why would you do that for non-int enum values?  There's lots of ways you could
store enum values in a database.   In Mailman, I use regular enums (not
IntEnums) but I use int values and store them in the database as INTEGERS.  I
could just as easily have used a string type and stored the enum member name
in the database.  Using subclasses and __members__ I think there's lots of
other viable alternatives that don't require changing the Enum API.

--

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



[issue22504] Add ordering between `Enum` objects

2014-09-27 Thread Ram Rachum

Ram Rachum added the comment:

My particular use case is that I have objects with a tuple of enum objects to 
each, and I want the tuple to be in canonical order rather than random, for 
convenience.

I can easily use a subclass, but I think it's general enough functionality for 
it to be included in the standard library.

--

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



[issue22505] Expose an Enum object's serial number

2014-09-27 Thread Ram Rachum

Ram Rachum added the comment:

 https://docs.python.org/3/library/enum.html#orderedenum

As I said in the other ticket: I can easily use a subclass, but I think it's 
general enough functionality for it to be included in the standard library.

I could continue the discussion about databases, but it feels like a waste of 
time to me. The main principle is: If something has an important property (in 
this case an enum object's numerical value), it should be publicly exposed. 
Period. No need to spend hours discussing if and how that property will be 
used. They always end up getting used somehow-- The only question is whether 
the people using them need to obtain them through private variables for years 
until the developers finally understand that the property needs to be exposed 
publicly. If you want to go through that, be my guest.

--

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



[issue19569] Use __attribute__((deprecated)) to warn usage of deprecated functions and macros

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Deprecated macros can be replaced by deprecated functions.

--

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



[issue11102] configure doesn't find major() on HP-UX v11.31

2014-09-27 Thread R. David Murray

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


--
nosy:  -r.david.murray
stage: commit review - needs patch
versions: +Python 3.4, Python 3.5

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



[issue20140] UnicodeDecodeError in ntpath.py when home dir contains non-ascii signs

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This looks to me as documentation issue. Unfortunately it is not explicitly 
documented that os.path.join() shouldn't mix str and unicode components (except 
ascii-only str, such as '.').

There is relevant note in 3.x documentation. It should be adapted to 2.7.

--
assignee:  - docs@python
components: +Documentation -Windows
keywords: +easy
nosy: +docs@python, serhiy.storchaka
stage:  - needs patch
type: crash - behavior

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



[issue16121] shlex.shlex.error_leader() reports incorrect line number

2014-09-27 Thread R. David Murray

R. David Murray added the comment:

I think I'll leave it up to whoever works on this whether they want to tackle 
making posix mode and non-posix mode return the same values or turn this into 
an enhancement ticket for the proposed wrapped_lineno.  Or, if no one is 
interested, we can just close this.  (Or, third option, turn it into a doc 
issue and document exactly what shlex actually does with lineno).

--
stage: commit review - needs patch
versions: +Python 3.5 -Python 3.2, Python 3.3

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



[issue11479] Add discussion of trailing backslash in raw string to tutorial

2014-09-27 Thread R. David Murray

R. David Murray added the comment:

I'm on a quest to clear my 'commit ready' queue.  This issue needs to go back 
to 'needs patch' stage...I'll leave it to someone else to rewrite my original 
patch based on the feedback, since it is unlikely I will get back to it any 
time soon.  I'll commit it if someone else does the revision and moves it back 
to commit review, though ;)

--
stage: commit review - needs patch
versions: +Python 3.5 -Python 3.2, Python 3.3

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



[issue4755] Add function to get common path prefix

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is more developed patch in issue10395.

--
nosy: +serhiy.storchaka

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



[issue20267] TemporaryDirectory does not resolve path when created using a relative path

2014-09-27 Thread Yury Selivanov

Yury Selivanov added the comment:

 Note that abspath() can return incorrect result in case of symbolic links to 
 directories and pardir components. I.e. abspath('symlink/..').

Good catch.. Should I use os.path.realpath?

--

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



[issue22505] Expose an Enum object's serial number

2014-09-27 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Sep 27, 2014, at 04:15 PM, Ram Rachum wrote:

The main principle is: If something has an important property (in this case
an enum object's numerical value), it should be publicly exposed.

I think this is a misunderstanding.  Only IntEnum members have a defined
numerical value.  Base Enum members have no inherent value semantics except
their existence.  The *syntax* of using integers for values is simply a
convention and one that's not even necessary for Enums to work properly.

Enum members are also defined to be unordered, so their serial number is
meaningless.  The fact that __members__ is an ordered dictionary is a
convenient implementation detail that's only exposed in the API to support
iteration over all members including aliases.

Let me say specifically that I am opposed to int() for coercion for
non-IntEnums because Enum values can be anything.  Likewise, member.number is
also a misnomer in this case:

 from enum import Enum
 class Colors(Enum):
...a = 'a'
...b = 'b'
...c = 'c'
...
 Colors.a is Colors.b
False
 Colors.a is Colors.a
True

I think using IntEnums or a subclass to provide a convenient wrapper around
__members__ iteration is the only thing that makes sense here, but I still
don't think the stdlib needs to support it.  IMHO, this is a case where adding
to the public stdlib API would provide more complexity for little common
benefit.

--

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



[issue22505] Expose an Enum object's serial number

2014-09-27 Thread Ram Rachum

Ram Rachum added the comment:

 Enum members are also defined to be unordered, so their serial number is 
 meaningless.

Are you sure? The documentation says Enumerations support iteration, in 
definition order and shows how `tuple(MyEnum)` outputs the values in 
definition order.


 Likewise, member.number is also a misnomer in this case:

I don't understand why it's a misnomer in the case you showed.

--

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



[issue20021] modernize makeopcodetargets.py

2014-09-27 Thread Berker Peksag

Berker Peksag added the comment:

Here's a patch.

--
keywords: +patch
nosy: +berker.peksag, brett.cannon
stage: needs patch - patch review
Added file: http://bugs.python.org/file36745/issue20021.diff

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



[issue19062] Idle: problem confighandler getting userdir

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I suppose that on patrick's computeron his account (but not on admin account) 
HOME is literal %userprofile%. It looks as just misconfiguration.

--
nosy: +serhiy.storchaka

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



[issue6623] Lib/ftplib.py Netrc class should be removed.

2014-09-27 Thread Francis MB

Francis MB added the comment:

I've downloaded 'remove_Netrc_class2.patch' and passes the test suite, the 
examples on the documentation run ok and manually from the command line:

$hg tip
changeset:   92597:e29866cb6b98
tag: tip
parent:  92594:d43d4d4ebf2c
parent:  92596:54987723de99
...
$ hg status
M Lib/ftplib.py
M Lib/test/test_ftplib.py
? Modules/_testembed
$ ./python -m ftplib -d ftp.debian.org -ddebian
*cmd* 'USER anonymous'
*resp* '331 Please specify the password.'
*cmd* 'PASS *'
*resp* '230 Login successful.'
*cmd* 'CWD debian'
*resp* '250 Directory successfully changed.'
*cmd* 'QUIT'
*resp* '221 Goodbye.'

My test '.netrc' file was:
$ cat ~/.netrc 
machine ftp.debian.org
login anonymous
password anonymous

The patch also looks good for me.

--
nosy: +francismb

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



[issue6623] Lib/ftplib.py Netrc class should be removed.

2014-09-27 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag
stage: needs patch - patch review

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



[issue22507] PyType_IsSubtype doesn't call __subclasscheck__

2014-09-27 Thread Maries Ionel Cristian

New submission from Maries Ionel Cristian:

It appears it just does a reference check: 
https://hg.python.org/cpython/file/3.4/Objects/typeobject.c#l1300

It appears it's the same in 2.7: 
https://hg.python.org/cpython/file/2.7/Objects/typeobject.c#l1161

But this is not the intended behaviour right?

--
components: Interpreter Core
messages: 227706
nosy: ionel.mc
priority: normal
severity: normal
status: open
title: PyType_IsSubtype doesn't call __subclasscheck__
versions: Python 2.7, Python 3.4, Python 3.5

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



[issue6623] Lib/ftplib.py Netrc class should be removed.

2014-09-27 Thread R. David Murray

R. David Murray added the comment:

Great.  The patch looks good to me, too.

Can someone add a What's New removal entry to the patch?  (See the 3.4 What's 
New for a model of what removals look like in What's New.)  (It would also be 
nice if the patch were in hg format so that we get a 'review' link, but that's 
not critical as I don't think we need a line-by-line review here).

--
stage: patch review - needs patch

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



[issue4755] Add function to get common path prefix

2014-09-27 Thread Skip Montanaro

Skip Montanaro added the comment:

Feel free to close this ticket. I long ago gave up on it.

--

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



[issue22501] Optimise PyLong division by 1 or -1

2014-09-27 Thread Stefan Behnel

Stefan Behnel added the comment:

One more comment: I also benchmarked the change in long_true_div() now and 
found that it's only a minor improvement for large numbers and a 
*pessimisation* for small numbers:

Before:

$ ./python -m timeit -s 'x = 5' 'x / -1'
1000 loops, best of 3: 0.0313 usec per loop
$ ./python -m timeit -s 'x = 5' 'x / 1'
1000 loops, best of 3: 0.0307 usec per loop

$ ./python -m timeit -s 'x = 2**200 + 3**234 + 5**89 + 7**123' 'x / 1'
1000 loops, best of 3: 0.101 usec per loop
$ ./python -m timeit -s 'x = 2**200 + 3**234 + 5**89 + 7**123' 'x / -1'
1000 loops, best of 3: 0.104 usec per loop


Patched:

$ ./python -m timeit -s 'x = 5' 'x / 1'  
1000 loops, best of 3: 0.0569 usec per loop
$ ./python -m timeit -s 'x = 5' 'x / -1'
1000 loops, best of 3: 0.0576 usec per loop

$ ./python -m timeit -s 'x = 2**200 + 3**234 + 5**89 + 7**123' 'x / -1'
1000 loops, best of 3: 0.056 usec per loop
$ ./python -m timeit -s 'x = 2**200 + 3**234 + 5**89 + 7**123' 'x / 1' 
1000 loops, best of 3: 0.056 usec per loop

$ ./python -m timeit -s 'x = 2**200 + 3**234 + 5**89 + 7**123' 'x / -2'
1000 loops, best of 3: 0.106 usec per loop


So, just for completeness, here's the patch without that part, with changes 
only in l_divmod() and long_mul(), with the timeit results as given in my 
previous comment.

--
Added file: http://bugs.python.org/file36746/mul_div_by_1_fast_path_3.patch

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



[issue9104] test.support method for dual-testing accelerated code (fixes test_exceptions and other's pickle testing)

2014-09-27 Thread R. David Murray

R. David Murray added the comment:

Looks like there is still some disagreement about the implementation here, so 
this isn't actually ready to commit yet?

--
resolution: accepted - 
stage: commit review - needs patch
title: test_exceptions does not test pickling with pickle.py - test.support 
method for dual-testing accelerated code (fixes test_exceptions and other's 
pickle testing)
versions: +Python 3.5 -Python 3.2

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



[issue22486] Add math.gcd()

2014-09-27 Thread Stefan Behnel

Stefan Behnel added the comment:

My personal take is: if there is an implementation in the stdlib, it should be 
the one that's most widely applicable. And that includes large numbers. We have 
a working implementation that is algorithmically faster for large numbers, so I 
can't see why we should drop it unused.

I'm for merging patch 7.

--

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



[issue7665] test_urllib2 and test_ntpath fail if path contains \

2014-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The ntpath test failure is replicated when the test is ran directly:

~/py/cpython\1$ ./python Lib/test/test_ntpath.py
sE.
==
ERROR: test_relpath (__main__.TestNtpath)
--
Traceback (most recent call last):
  File Lib/test/test_ntpath.py, line 314, in test_relpath
tester('ntpath.relpath(a, ../b)', '..\\'+currentdir+'\\a')
  File Lib/test/test_ntpath.py, line 16, in tester
%(str(fn), str(wantResult), str(gotResult)))
test.support.TestFailed: ntpath.relpath(a, ../b) should return: 
..\cpython\1\a but returned: ..\1\a

--

Here is a patch with a fix of test_ntpath and with simpler fix of test_urllib2.

--
nosy: +serhiy.storchaka
versions: +Python 3.4, Python 3.5

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



[issue20974] email module docs say not compatible with current python version

2014-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2eea52c287b7 by R David Murray in branch '3.4':
#20974: Update version table in email intro.
https://hg.python.org/cpython/rev/2eea52c287b7

New changeset 655b34cd8871 by R David Murray in branch 'default':
Merge: #20974: Update version table in email intro.
https://hg.python.org/cpython/rev/655b34cd8871

--
nosy: +python-dev

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



[issue20974] email module docs say not compatible with current python version

2014-09-27 Thread R. David Murray

R. David Murray added the comment:

I've updated the table (thanks for the patch) but noted that after 5.1/3.2 
there is no independent email version.  I'd like to just delete __version__ in 
3.5, but I don't know if I have to deprecate the constant first :)  It didn't 
get updated in 3.3 or 3.4, so it isn't *accurate* in any case.

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

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



[issue18854] is_multipart and walk should document their treatment of 'message' parts.

2014-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b717128799b5 by R David Murray in branch '3.4':
#18854: make it explicit that is_multipart does not mean 'multipart/xxx'.
https://hg.python.org/cpython/rev/b717128799b5

New changeset 9909de463dc9 by R David Murray in branch 'default':
Merge: #18854: make it explicit that is_multipart does not mean 'multipart/xxx'.
https://hg.python.org/cpython/rev/9909de463dc9

--
nosy: +python-dev

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



[issue18854] is_multipart and walk should document their treatment of 'message' parts.

2014-09-27 Thread R. David Murray

R. David Murray added the comment:

Thanks Abhilash.  I decided to use the full example after all, but tuned up the 
language a bit.

--
resolution:  - fixed
stage: commit review - resolved
status: open - closed
type:  - behavior
versions: +Python 3.5 -Python 3.3

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



[issue16537] Python’s setup.py raises a ValueError when self.extensions is empty

2014-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a169ee4f254a by Berker Peksag in branch '3.4':
Issue #16537: Check whether self.extensions is empty in setup.py.
https://hg.python.org/cpython/rev/a169ee4f254a

New changeset 491a4d3e2bdd by Berker Peksag in branch 'default':
Issue #16537: Check whether self.extensions is empty in setup.py.
https://hg.python.org/cpython/rev/491a4d3e2bdd

--
nosy: +python-dev

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



[issue16537] Python’s setup.py raises a ValueError when self.extensions is empty

2014-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6946036f21ef by Berker Peksag in branch '2.7':
Issue #16537: Check whether self.extensions is empty in setup.py.
https://hg.python.org/cpython/rev/6946036f21ef

--

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



[issue16537] Python’s setup.py raises a ValueError when self.extensions is empty

2014-09-27 Thread Berker Peksag

Berker Peksag added the comment:

Committed. Thanks for the patch, Jonathan!

--
assignee:  - berker.peksag
nosy: +berker.peksag
resolution:  - fixed
stage: commit review - resolved
status: open - closed
versions: +Python 3.5 -Python 3.2, Python 3.3

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



[issue10702] bytes and bytearray methods are not documented

2014-09-27 Thread Berker Peksag

Berker Peksag added the comment:

Fixed in issue 21777.

--
nosy: +berker.peksag
resolution:  - out of date
stage: needs patch - resolved
status: open - closed

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



[issue16252] bytes and bytearray methods are undocumented

2014-09-27 Thread Berker Peksag

Berker Peksag added the comment:

Fixed in issue 21777.

--
nosy: +berker.peksag
resolution:  - out of date
stage: needs patch - resolved
status: open - closed

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



[issue22103] bdist_wininst does not run install script

2014-09-27 Thread Cybjit

Cybjit added the comment:

Probably caused by issue #21354

--
nosy: +Cybjit

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



[issue22251] Various markup errors in documentation

2014-09-27 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


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

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



[issue22251] Various markup errors in documentation

2014-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0ec56e677bc3 by Berker Peksag in branch '3.4':
Issue #22251: Fix ReST markup to avoid errors building docs.
https://hg.python.org/cpython/rev/0ec56e677bc3

New changeset ed1dbac90b92 by Berker Peksag in branch 'default':
Issue #22251: Fix ReST markup to avoid errors building docs.
https://hg.python.org/cpython/rev/ed1dbac90b92

--
nosy: +python-dev

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



[issue22251] Various markup errors in documentation

2014-09-27 Thread Berker Peksag

Berker Peksag added the comment:

See issue 16805 for a similar issue.

--

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



[issue22251] Various markup errors in documentation

2014-09-27 Thread Georg Brandl

Georg Brandl added the comment:

These errors are all valid markup.  They would have been discovered much 
earlier had they been errors.

Please consider checking why your Sphinx setup produces the errors, fixing it 
and then reverting the changes.

--

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



[issue22251] Various markup errors in documentation

2014-09-27 Thread R. David Murray

R. David Murray added the comment:

I suppose this is one disadvantage of using the system sphinx when 'make html' 
is run?

--
nosy: +r.david.murray
status: closed - open

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



[issue22504] Add ordering between `Enum` objects

2014-09-27 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy: +ethan.furman

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



[issue22506] `dir` on Enum subclass doesn't expose parent class attributes

2014-09-27 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy: +ethan.furman

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



[issue19569] Use __attribute__((deprecated)) to warn usage of deprecated functions and macros

2014-09-27 Thread eryksun

eryksun added the comment:

MSC has __declspec(deprecated). See http://stackoverflow.com/a/21265197, for 
example. It's a level 3 (/W3) warning.

http://msdn.microsoft.com/en-us/library/ttcz0bys%28v=vs.100%29.aspx

--
nosy: +eryksun

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



[issue10510] distutils upload/register should use CRLF in HTTP requests

2014-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5e3f8bd33cf2 by R David Murray in branch '3.4':
#10510: make distuitls upload/register use HTML standards compliant CRLF.
https://hg.python.org/cpython/rev/5e3f8bd33cf2

New changeset ea665bae2ea0 by R David Murray in branch 'default':
Merge: #10510: make distuitls upload/register use HTML standards compliant CRLF.
https://hg.python.org/cpython/rev/ea665bae2ea0

New changeset 9ad78b4b169c by R David Murray in branch '2.7':
#10510: make distuitls upload/register use HTML standards compliant CRLF.
https://hg.python.org/cpython/rev/9ad78b4b169c

--
nosy: +python-dev

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



[issue10510] distutils upload/register should use CRLF in HTTP requests

2014-09-27 Thread R. David Murray

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


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

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



[issue22251] Various markup errors in documentation

2014-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0b84904c9471 by Berker Peksag in branch '3.4':
Revert #22251
https://hg.python.org/cpython/rev/0b84904c9471

New changeset 78ae78f967f1 by Berker Peksag in branch 'default':
Revert #22251
https://hg.python.org/cpython/rev/78ae78f967f1

--

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



[issue22251] Various markup errors in documentation

2014-09-27 Thread Berker Peksag

Berker Peksag added the comment:

I was using Sphinx 1.2.2 and found two related issues: issue 16805 and issue 
20961.

I've just upgraded Sphinx to 1.2.3, did a clean checkout, reverted the changes 
and everything looks good.

Sorry for the noise!

--
status: open - closed

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



[issue16837] Number ABC can be instantiated

2014-09-27 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
components: +Library (Lib)
versions: +Python 3.5 -Python 3.3

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



[issue22508] Remove __version__ string from email

2014-09-27 Thread R. David Murray

New submission from R. David Murray:

There is no longer a concept of a separate 'email' release from the stdlib 
release.  The __version__ string didn't get updated in either 3.3 or 3.4 (my 
fault).  I propose that we simply delete the __version__ variable from 
__init__.py (patch attached).

Any objections?

--
components: email
files: remove_email_version.patch
keywords: patch
messages: 227731
nosy: barry, r.david.murray
priority: normal
severity: normal
status: open
title: Remove __version__ string from email
versions: Python 3.5
Added file: http://bugs.python.org/file36747/remove_email_version.patch

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



[issue16837] Number ABC can be instantiated

2014-09-27 Thread Claudiu Popa

Claudiu Popa added the comment:

I'd say that this should be fixed, it breaks the expectancy imposed by the 
documentation, so +1 from me.

--
nosy: +Claudiu.Popa

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



[issue22508] Remove __version__ string from email

2014-09-27 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Sep 27, 2014, at 09:05 PM, R. David Murray wrote:

There is no longer a concept of a separate 'email' release from the stdlib
release.  The __version__ string didn't get updated in either 3.3 or 3.4 (my
fault).  I propose that we simply delete the __version__ variable from
__init__.py (patch attached).

+1

-Barry

--

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



[issue17849] Missing size argument in readline() method for httplib's class LineAndFileWrapper

2014-09-27 Thread R. David Murray

R. David Murray added the comment:

I tried the patch, but the test fails for me:

test test_httplib failed -- Traceback (most recent call last):
  File /home/rdmurray/python/p27/Lib/test/test_httplib.py, line 434, in 
test_proxy_tunnel_without_status_line
conn.set_tunnel('foo')
  File /home/rdmurray/python/p27/Lib/httplib.py, line 734, in set_tunnel
raise RuntimeError(Can't setup tunnel for established connection.)
RuntimeError: Can't setup tunnel for established connection.

--
stage: commit review - needs patch

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



[issue21578] Misleading error message when ImportError called with invalid keyword args

2014-09-27 Thread R. David Murray

R. David Murray added the comment:

The standard error message for this case is:

  xxx() got an unexpected keyword argument 'foo'

I have no idea where that gets generated (a grep didn't teach me anything 
useful), but I think it would make sense to use that form for the message.

I think the fix can be applied to 3.4.

--
stage: commit review - needs patch
type: enhancement - behavior
versions: +Python 3.4

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



[issue10766] optparse uses %s in gettext calls

2014-09-27 Thread R. David Murray

R. David Murray added the comment:

OK, since there seems to be some concern about backward compatibility (in the 
related argparse issue) and optparse is indeed no longer maintained, let's 
close this.

--
resolution:  - rejected
stage: commit review - resolved
status: open - closed

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



[issue22504] Add ordering between `Enum` objects

2014-09-27 Thread Ethan Furman

Ethan Furman added the comment:

Enums have a definition order to aid in the use-case of auto-numbering, and to 
make displays consistent.  However, the basic Enum type is unordered.

If you need/want your particular enum type to be ordered, mix-in the ordered 
magic methods.

--
assignee:  - ethan.furman
resolution:  - rejected
stage:  - resolved
status: open - closed

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



[issue21044] tarfile does not handle file .name being an int

2014-09-27 Thread R. David Murray

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


--
stage: commit review - test needed
versions: +Python 2.7 -Python 3.4, Python 3.5

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



[issue22505] Expose an Enum object's serial number

2014-09-27 Thread Ethan Furman

Ethan Furman added the comment:

Yes, we're sure.  ;)

Enums have a definition order to aid in the use-case of auto-numbering, and to 
make displays consistent.  However, the basic Enum type is unordered.

I do not see a serial number as being an intrinsic property of an enum -- 
outside of auto-numbering (also not available in the stdlib), what difference 
does it make what order it was defined in?  What matters is the name and the 
value.

If you want your enum to have a serial number you can easily add that 
functionality in.

--
assignee:  - ethan.furman
resolution:  - rejected
stage:  - resolved
status: open - closed

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



[issue22506] `dir` on Enum subclass doesn't expose parent class attributes

2014-09-27 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
stage:  - test needed

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



[issue22506] `dir` on Enum subclass doesn't expose parent class attributes

2014-09-27 Thread Ram Rachum

Ram Rachum added the comment:

Ethan, I saw you just marked this as test needed. I just gave you code to 
reproduce this problem. Isn't that sufficient? Or you want me to do add it to 
Python's test suite?

--

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



[issue22139] python windows 2.7.8 64-bit did not install

2014-09-27 Thread Henning von Bargen

Henning von Bargen added the comment:

Martin, while I technically understand your anwers, I have to say that from an 
ordinary developer's perspective, the behavior is actually *not* expected.

It may be expected for python-dev experts, but not for those who are just 
programming _with_ python.

It did cost me half a day to find out what's going on. Luckily, this happened 
on an internal development machine and not while installing the application on 
one of our customer's machine.

IIRC earlier versions of python did not install a python2*.* ZIP or DLL into 
%WINDIR%\System32.

It should at least be documented that installing two different 2.7.x releases 
on the same machine is not supported.

Furthermore, the technical difference between install for all users and 
install just for me is not clear.

As you said, the docs do not even mention that after an installation for all 
users the system uses %WINDIR%\System32\python2x.zip for searching libraries.

For a developer it is not obvious that hmac is built in while other standard 
libs (implemented in pure Python) are not.

BTW, if it was built-in (technically), then it could not be not found, as it 
happened to Andreas and me.
Fool-proof built-in would mean: statically linked with the executable, not in a 
DLL.

I recommend to keep things as is, but add a few sentences to the docs.

--

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



[issue22103] bdist_wininst does not run install script

2014-09-27 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +steve.dower, tim.golden, zach.ware

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



[issue20135] FAQ need list mutation answers

2014-09-27 Thread R. David Murray

R. David Murray added the comment:

Here is my version of Ezio's patch.

--
Added file: http://bugs.python.org/file36748/mutable_faq.patch

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



[issue19062] Idle: problem confighandler getting userdir

2014-09-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The fact that Idle quits when there is a problem getting (or writing to) the 
home directory is a design bug discussed in #8231.  I do not see any other bug 
with Idle.  So I am closing this as a duplicate.

--
resolution:  - duplicate
stage: test needed - resolved
status: open - closed
superseder:  - Unable to run IDLE without write-access to home directory

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



  1   2   >