[issue24275] lookdict_* give up too soon

2021-03-31 Thread Hristo Venev


Hristo Venev  added the comment:

Sorry, I must have missed Inada Naoki's reply. I will try to send a pull 
request this weekend.

--

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



[issue24275] lookdict_* give up too soon

2021-01-31 Thread Hristo Venev


Hristo Venev  added the comment:

I've attached a patch that should also contain a test.

I also ran some benchmarks on dict creation/inserts. I couldn't notice any 
difference in performance.

--
Added file: 
https://bugs.python.org/file49782/0001-Don-t-downgrade-unicode-only-dicts-to-mixed-on-non-u.patch

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



[issue24275] lookdict_* give up too soon

2021-01-30 Thread Hristo Venev


Hristo Venev  added the comment:

> Why is the first key built up as vx='x'; vx += '1' instead of just k1="x1"?

I wanted to construct a key that is equal to, but not the same object as, 
`'x1'`. Consider this example:

assert 'x1' is 'x1'
spam = 'x1'
assert spam is 'x1'
eggs = 'x'
eggs += '1'
assert eggs == 'x1'
assert eggs is not 'x1'
assert sys.intern(eggs) is 'x1'

When doing a dict lookup and the lookup key is the same object as a stored 
entry, `__eq__` is not called. Lookups are then significantly faster, maybe 20%.

Consider this example:

class EqTest:
def __eq__(self, other):
raise RuntimeError
def __hash__(self):
return id(self)

adict = {}
k1 = EqTest()
k2 = EqTest()

adict[k1] = 42
adict[k2] = 43
print(adict[k1], adict[k2])

Here `k1` is considered the same as `k1` and `k2` is considered the same as 
`k2`. However, `k1` and `k2` are considered distinct and never compared because 
they have different hashes.

However, if we were to set `EqTest.__hash__ = lambda self: 42`, we'd get a 
RuntimeError when we try to set `adict[k2]` because it would get compared for 
equality with `k1`.

Even if `__eq__` works, we can get some interesting behaviors. For example, 
when using multiple instances of `float('nan')` as keys.

> Using a str subclass in the test is a great idea, and you've created a truly 
> minimal one.  It would probably be good to *also* test with a non-string, 
> like 3 or 42.0.  I can't imagine this affecting things (unless you missed an 
> eager lookdict demotion somewhere), but it would be good to have that path 
> documented against regression.

I also tested a custom class that compares equal to strings. Other than being 
much slower, there weren't any significant differences. I also did some checks 
with int key lookups, which obviously fail with KeyError. They did not make the 
performance worse for the subsequent str lookups.

I will try to make a proper test tomorrow.

--

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



[issue24275] lookdict_* give up too soon

2021-01-28 Thread Hristo Venev


Hristo Venev  added the comment:

Benchmark program attached.

0. Creates a dict with str keys
1. str lookups
2. str subclass lookups on the same dict
3. str lookups on the same dict

Results before patch:
0.9493069459404069 +- 0.004707371313935551
1.47313450980997 +- 0.01350596115630158
1.3181799192904144 +- 0.006550182814933545

Results after patch:
0.9498907704499289 +- 0.003721378313122522
1.4936510094799451 +- 0.057905386684185135
0.9494844124498195 +- 0.0029465760297623235

--
Added file: https://bugs.python.org/file49773/bench.py

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



[issue24275] lookdict_* give up too soon

2021-01-28 Thread Hristo Venev


Hristo Venev  added the comment:

I've attached a patch. I will soon provide benchmark results.

--
keywords: +patch
nosy: +h.venev
Added file: 
https://bugs.python.org/file49772/0001-Don-t-downgrade-unicode-only-dicts-to-mixed-on-non-u.patch

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



[issue30528] ipaddress.IPv{4,6}Network.reverse_pointer is broken

2017-05-31 Thread Hristo Venev

New submission from Hristo Venev:

`ipaddress.IPv4Network('127.0.0.0/16').reverse_pointer = 
'0/16.0.0.127.in-addr.arpa'` is definitely wrong. I think it should be 
'0.127.in-addr.arpa'.

A funnier case, `ipaddress.IPv6Network('2001:db8::/32').reverse_pointer = 
'2.3./.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'`.

For the case where no single reverse pointer exists (e.g. `127.0.0.0/13`), I 
think it should be `None`.

--
components: Library (Lib)
messages: 294854
nosy: h.venev
priority: normal
severity: normal
status: open
title: ipaddress.IPv{4,6}Network.reverse_pointer is broken
type: behavior
versions: Python 3.5

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



[issue22367] Add open_file_descriptor parameter to fcntl.lockf() (use the new F_OFD_SETLK flag)

2016-03-08 Thread Hristo Venev

Hristo Venev added the comment:

Here is the OFD patch, I'll open another issue for the overflow bug.

--
versions: +Python 3.6
Added file: 
http://bugs.python.org/file42093/0002-fcntl-Support-Linux-open-file-descriptor-locks.patch

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



[issue22367] Please add F_OFD_SETLK, etc support to fcntl.lockf

2016-03-07 Thread Hristo Venev

Hristo Venev added the comment:

This implements the open_file_descriptor argument and fixes a bug with 
converting to int when off_t is 64-bit but long is 32-bit.

--
keywords: +patch
Added file: http://bugs.python.org/file42085/0001-fcntl-support-F_OFD_.patch

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



[issue22367] Please add F_OFD_SETLK, etc support to fcntl.lockf

2016-03-07 Thread Hristo Venev

Hristo Venev added the comment:

I'd like to use fd locks from python too.

--
nosy: +h.venev

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



[issue26026] True%2 is True

2016-01-07 Thread Hristo Venev

Hristo Venev added the comment:

One last thing: type(a%b) is A, type(b%a) is int.

--

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



[issue26026] True%2 is True

2016-01-06 Thread Hristo Venev

Changes by Hristo Venev <hri...@venev.name>:


--
title: True%2==True -> True%2 is True

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



[issue26026] True%2==True

2016-01-06 Thread Hristo Venev

New submission from Hristo Venev:

Should be 1. This comes from the (a%b=a if a<b) optimization.

Let's be consistent with all other arithmetic operations.

--
components: Interpreter Core
messages: 257629
nosy: h.venev
priority: normal
severity: normal
status: open
title: True%2==True
versions: Python 3.5

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



[issue23609] Export PyModuleObject in moduleobject.h

2015-10-05 Thread Hristo Venev

Hristo Venev added the comment:

Quote from PEP 489:
The Py_mod_create slot is used to support custom module subclasses.

There is no way to subclass PyModuleObject from C.

--
versions: +Python 3.5 -Python 3.4

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



[issue23869] Initialization is being done in PyType_GenericAlloc

2015-04-04 Thread Hristo Venev

Changes by Hristo Venev hri...@venev.name:


--
components: +Interpreter Core
versions: +Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

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



[issue23869] Initialization is being done in PyType_GenericAlloc

2015-04-04 Thread Hristo Venev

New submission from Hristo Venev:

In PyType_GenericAlloc, the initialization is being done. Namely, the PyObject 
part of the object is initialized and it is tracked by the garbage collector.

In the documentation it is stated that tp_alloc should do no initialization.

--
messages: 240080
nosy: h.venev
priority: normal
severity: normal
status: open
title: Initialization is being done in PyType_GenericAlloc

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



[issue23868] Uninitialized objects are tracked by the garbage collector

2015-04-04 Thread Hristo Venev

New submission from Hristo Venev:

An object starts being tracked by the GC after being allocated, but before 
being initialized. If during initialization the GC runs, this may lead to 
tp_traverse being called on an uninitialized object.

--
components: Interpreter Core
messages: 240079
nosy: h.venev
priority: normal
severity: normal
status: open
title: Uninitialized objects are tracked by the garbage collector
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

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



[issue23609] Export PyModuleObject in moduleobject.h

2015-03-08 Thread Hristo Venev

New submission from Hristo Venev:

Please export PyModuleObject in moduleobject.h.

It's useful for subclassing module in C.

--
components: Interpreter Core
messages: 237543
nosy: h.venev
priority: normal
severity: normal
status: open
title: Export PyModuleObject in moduleobject.h
versions: Python 3.4

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



[issue22759] pathlib: Path.exists broken

2014-10-30 Thread Hristo Venev

Hristo Venev added the comment:

Should I file bugs for is_dir, is_file, is_symlink, is_socket, is_fifo, 
is_block_device and is_char_device?

--

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



[issue22759] pathlib: Path.exists broken

2014-10-29 Thread Hristo Venev

New submission from Hristo Venev:

$ touch a
c: stat(a/x, ...) - errno=ENOTDIR
$ python
 pathlib.Path('a/x').exists()

This should return False and not throw an exception.

Patch not tested.

--
files: py.patch
keywords: patch
messages: 230214
nosy: h.venev
priority: normal
severity: normal
status: open
title: pathlib: Path.exists broken
Added file: http://bugs.python.org/file37066/py.patch

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



[issue22759] pathlib: Path.exists broken

2014-10-29 Thread Hristo Venev

Hristo Venev added the comment:

Tested and works.

--

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



[issue22759] pathlib: Path.exists broken

2014-10-29 Thread Hristo Venev

Hristo Venev added the comment:

ENAMETOOLONG and possibly ELOOP should also return False.
EACCES, EOVERFLOW and ENOMEM should probably be forwarded.
EFAULT should not happen.

--

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



[issue22252] ssl blocking IO errors

2014-08-23 Thread Hristo Venev

Hristo Venev added the comment:

My questions are:
When will SSLSocket.recv() raise SSLWantWriteError?
When will SSLSocket.send() raise SSLWantReadError?

According to my very basic knowledge abou the protocol, this will never happen.

--

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



[issue22252] ssl blocking IO errors

2014-08-22 Thread Hristo Venev

New submission from Hristo Venev:

ssl.SSLWantReadError and ssl.SSLWantWriteError should inherit 
io.BlockingIOError.

Generic code that works with non-blocking sockets will stop working with 
SSLSockets.

Does anybody have any idea if SSLSocket.read() will need to write to the 
underlying socket or SSLSocket.write() need to read from it? AFAIK they don't.

Assuming that ssl.SSLWantReadErorr and ssl.SSLWantWriteError perfectly map to 
io.BlockingIOError (except during handshake).

--
components: Library (Lib)
messages: 225687
nosy: h.venev
priority: normal
severity: normal
status: open
title: ssl blocking IO errors
versions: Python 3.4

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



[issue21922] PyLong: use GMP

2014-07-07 Thread Hristo Venev

Hristo Venev added the comment:

After optimization, tests on small ints ( 2**30)

Currently only addition, subtraction, negation and ~ are a bit slower ( 5%).

Most other operations are the same. Bitwise operators, //, %, ** and pow are 
faster.

Converting to and from strings is a bit faster. pickle, marshal and json are 
faster.

bm_nqueens is a bit slower. pystone is a bit faster. There are no performance 
regressions in other benchmarks.

When I fix +,- and ~ I will reupload the patch.

--

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



[issue21922] PyLong: use GMP

2014-07-05 Thread Hristo Venev

New submission from Hristo Venev:

I have implemented the PyLong interface using the GMP mpn functions. API/ABI 
compatibility is retained (except for longintrepr).

It can be enabled by passing --enable-big-digits=gmp to ./configure.

No large performance regressions have been observed for small numbers (a few 
operations are about 10% slower). For large numbers some operations are a lot 
faster.

There is also int.__gcd__ which may be used by fractions.gcd.

The GIL is sometimes released. Minimum number of digis for releasing GIL: 
- multiplication - 64
- division - 64,
- modular exponentiation - 16,
- base conversion - 64 (256 for binary bases)
- GCD - 16

The tests for long, float, decimal, fractions, string, unicode, bytes, pickle, 
marshal and enum pass. The tests for int fail because the error messages are a 
bit different (when creating int from bytes or bytearray the value is not 
shown). I may have run other tests and they have not failed. I have not tested 
on anything but x86-64.

The following testcases yield 42x performace improvement:
- 16384-bit RSA on 8 threads on quad-core with HT # GIL released
- Multiplying 560-bit ints
- Dividing 600-bit ints
- Converting 30-character str to int(base=10)
- Converting 125-bit int to str

--
components: Interpreter Core
messages: 222347
nosy: h.venev
priority: normal
severity: normal
status: open
title: PyLong: use GMP
type: performance
versions: Python 3.5

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



[issue21922] PyLong: use GMP

2014-07-05 Thread Hristo Venev

Hristo Venev added the comment:

PyLongObject is a PyVarObject. It contains many mp_limb_t's. There is little 
overhead. For some operations if the result is in [-20;256] no memory will be 
allocated. There are special codepaths for 1-limb operations.

And I just finished GDB support.

Please test if it works for you.

--
keywords: +patch
Added file: http://bugs.python.org/file35867/pygmp.patch

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



[issue21922] PyLong: use GMP

2014-07-05 Thread Hristo Venev

Hristo Venev added the comment:

After some minor optimizations my implementation is about 1.8% slower on 
pystone and about 4% slower on bm_nqueens. It's 4 times faster on bm_pidigits.

--

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



[issue21909] PyLong_FromString drops const

2014-07-03 Thread Hristo Venev

New submission from Hristo Venev:

PyObject* PyLong_FromString(const char *str, char **pend, int base)

pend should be const char**

I think casting const away when not required should be a crime punishable by 
imprisonment.

--
messages: 222152
nosy: h.venev
priority: normal
severity: normal
status: open
title: PyLong_FromString drops const

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



[issue21909] PyLong_FromString drops const

2014-07-03 Thread Hristo Venev

Changes by Hristo Venev hri...@venev.name:


--
components: +Interpreter Core
type:  - security
versions: +Python 3.4

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



[issue1814] Victor Stinner's GMP patch for longs

2014-04-07 Thread Hristo Venev

Hristo Venev added the comment:

What about using PyVarObject of mp_limb_t and mpn instead of mpz_t? 

Addition:
   - Check signs and allocate.
   - Possibly compare absolute values.
   - Call mpn_(add|sub)_n and possibly mpn_(add|sub)_1 if the integers have 
different sizes.
   - Overhead for small integers: 1 Python-GMP, 1 if.

Subtraction:
   - Same as addition

Multiplication:
   - Check signs and allocate.
   - Call mpn_mul.
   - Overhead for small integers: 1 Python-GMP, 2 GMP-GMP, 3 if.

Division:
   - Check signs and allocate.
   - Call mpn_div_q.
   - Overhead for small integers: 1 Python-GMP, 1 GMP-GMP, 1 if, maybe a 3 
more ifs in mpn_divrem_1.

Pow:
   - Create mpz_t values using MPZ_ROINIT_N(limbs, size) and call mpz_pow(m?). 
Copy from mpz_limbs_read(result).

* The overhead is after checking if both arguments are integers until going to 
the right function (mpn_mul - mpn_mul_n - mpn_mul_basecase).

Checks for adding integers  1(GMP_NUMB_BITS-1), multiplying  
1(GMP_NUMB_BITS/2) and dividing  1GMP_NUMB_BITS can be added.

--
nosy: +h.venev

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



[issue21111] PyLong_AsUnsignedLongAndOverflow does not exist

2014-04-06 Thread Hristo Venev

Hristo Venev added the comment:

I will not add PyLong_AsUnsigned*AndOverflow in my code because I don't want my 
code to depend on the exact implementation of PyLong.

Are you seriously calling a 50-line function feature?

Anyway... I propose splitting the patch in two parts:
   - cleanup: the changes to Objects/longobject.c
   - feature: the changes to Include/longobject.h

cleanup can be applied to 3.4.1 because it adds no new features and helps 
maintainability. Backwards compatibility will not be broken.
feature can then be added in 3.5. Backwards compatibility should not be 
broken.

--

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



[issue21111] PyLong_AsUnsignedLongAndOverflow does not exist

2014-04-06 Thread Hristo Venev

Hristo Venev added the comment:

I did not intend to make it so that PyLong_AsUnsignedLong* to call __int__ but 
it looks like a good idea because PyLong_AsLong* does that and the patch is 
exactly about that - removing differences between converting to signed and 
unsigned.

Should I upload the patch with docs and with the warning fixed? Will it be 
applied in 3.4.1? It will be a lot easier to check the value of an int than to 
create a new PyLong = 2^64 and compare the number with that.

P.S.: is there a very fast way to check if a PyLong fits in unsigned long long 
with the limited API?
P.P.S.: Just a random idea: would it be a to rewrite PyLong to use GMP instead 
as a PyVarObject of mp_limb_t's?

--

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



[issue21111] PyLong_AsUnsignedLongAndOverflow does not exist

2014-04-05 Thread Hristo Venev

Hristo Venev added the comment:

Please apply in 3.4.1. I need this ASAP.

--
versions: +Python 3.4 -Python 3.5
Added file: http://bugs.python.org/file34738/a

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



[issue21111] PyLong_AsUnsignedLongAndOverflow does not exist

2014-04-05 Thread Hristo Venev

Hristo Venev added the comment:

Will you release 3.5 in the next few weeks?

--

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



[issue21111] PyLong_AsUnsignedLongAndOverflow does not exist

2014-03-31 Thread Hristo Venev

New submission from Hristo Venev:

It could set *overflow to -1 on negative value and to 1 on overflow.
And PyLong_AsUnsignedLongLongAndOverflow.

--
components: Extension Modules
messages: 215236
nosy: h.venev
priority: normal
severity: normal
status: open
title: PyLong_AsUnsignedLongAndOverflow does not exist
versions: Python 3.4

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



[issue21039] pathlib strips trailing slash

2014-03-23 Thread Hristo Venev

New submission from Hristo Venev:

Some programs' behavior is different depending on whether the path has a 
trailing slash or not. Examples include ls, cp, mv, ln, rm and rsync. URL paths 
may also behave differently. For example http://xkcd.com/1 redirects to 
http://xkcd.com/1/

Boost.Filesystem's path class also supports trailing slashes in paths. C++'s 
filesystem library proposal is also based on Boost.Filesystem.

--
components: Library (Lib)
files: pathlib.patch
keywords: patch
messages: 214581
nosy: h.venev
priority: normal
severity: normal
status: open
title: pathlib strips trailing slash
versions: Python 3.4
Added file: http://bugs.python.org/file34586/pathlib.patch

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



[issue21039] pathlib strips trailing slash

2014-03-23 Thread Hristo Venev

Hristo Venev added the comment:

What about OpenVMS?

--

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



[issue21039] pathlib strips trailing slash

2014-03-23 Thread Hristo Venev

Hristo Venev added the comment:

AFAIK paths on OpenVMS are represented in a strange way. [dir.subdir]filename 
is a path for a file and [dir.subdir.anothersubdir] is a path for a directory.

--

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



[issue21039] pathlib strips trailing slash

2014-03-23 Thread Hristo Venev

Hristo Venev added the comment:

Or maybe URLPath?

--

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



[issue21019] PyMethodDef ml_name is char* instead of const char*

2014-03-22 Thread Hristo Venev

New submission from Hristo Venev:

It would be better if string literals could be used there.

--
messages: 214451
nosy: h.venev
priority: normal
severity: normal
status: open
title: PyMethodDef ml_name is char* instead of const char*

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



[issue21021] PyMemberDef name is char* instead of const char*

2014-03-22 Thread Hristo Venev

New submission from Hristo Venev:

It would be better if string literals could be used there.

--
messages: 214453
nosy: h.venev
priority: normal
severity: normal
status: open
title: PyMemberDef name is char* instead of const char*

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



[issue21020] PyMethodDef ml_doc is char* instead of const char*

2014-03-22 Thread Hristo Venev

New submission from Hristo Venev:

It would be better if string literals could be used there.

--
messages: 214452
nosy: h.venev
priority: normal
severity: normal
status: open
title: PyMethodDef ml_doc is char* instead of const char*

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



[issue21022] PyMemberDef doc is char* instead of const char*

2014-03-22 Thread Hristo Venev

New submission from Hristo Venev:

It would be better if string literals could be used there.

--
messages: 214454
nosy: h.venev
priority: normal
severity: normal
status: open
title: PyMemberDef doc is char* instead of const char*

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



[issue21023] PyTypeObject tp_name is char* instead of const char*

2014-03-22 Thread Hristo Venev

New submission from Hristo Venev:

It would be better if string literals could be used there.

--
components: Extension Modules
messages: 214455
nosy: h.venev
priority: normal
severity: normal
status: open
title: PyTypeObject tp_name is char* instead of const char*
versions: Python 3.4

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



[issue21024] PyTypeObject tp_doc is char* instead of const char*

2014-03-22 Thread Hristo Venev

New submission from Hristo Venev:

It would be better if string literals could be used there.

--
components: Extension Modules
messages: 214456
nosy: h.venev
priority: normal
severity: normal
status: open
title: PyTypeObject tp_doc is char* instead of const char*
versions: Python 3.4

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



[issue21021] PyMemberDef name is char* instead of const char*

2014-03-22 Thread Hristo Venev

Changes by Hristo Venev hri...@venev.name:


--
components: +Extension Modules
versions: +Python 3.4

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



[issue21022] PyMemberDef doc is char* instead of const char*

2014-03-22 Thread Hristo Venev

Changes by Hristo Venev hri...@venev.name:


--
components: +Extension Modules
versions: +Python 3.4

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



[issue21019] PyMethodDef ml_name is char* instead of const char*

2014-03-22 Thread Hristo Venev

Changes by Hristo Venev hri...@venev.name:


--
components: +Extension Modules
versions: +Python 3.4

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



[issue21020] PyMethodDef ml_doc is char* instead of const char*

2014-03-22 Thread Hristo Venev

Changes by Hristo Venev hri...@venev.name:


--
components: +Extension Modules
versions: +Python 3.4

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



[issue21019] PyMethodDef ml_name is char* instead of const char*

2014-03-22 Thread Hristo Venev

Hristo Venev added the comment:

error: deprecated conversion from string constant to ‘char*’

I like -Werror.

--

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



[issue21019] PyMethodDef ml_name is char* instead of const char*

2014-03-22 Thread Hristo Venev

Hristo Venev added the comment:

g++

--

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



[issue21011] PyArg_ParseTupleAndKeywords doesn't take const char *keywords[]

2014-03-21 Thread Hristo Venev

New submission from Hristo Venev:

This really annoys me. I have to store the literals in char[] and then make a 
char*[] from them. It would be better if a simple array of string literals 
could be used. It would also require less data space because string literals 
could be merged by the compiler.

I don't know why PyArg_ParseTupleAndKeywords would ever modify the keywords 
array so it makes absolutely no sense to me for the array not to be const 
char*[].

In all cases I have seen PyArg_ParseTupleAndKeywords being used string literals 
were converted to char* (dropping const) which is far far worse than 
inefficient code.

--
components: Extension Modules
messages: 214388
nosy: h.venev
priority: normal
severity: normal
status: open
title: PyArg_ParseTupleAndKeywords doesn't take const char *keywords[]
type: resource usage
versions: Python 3.4

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