[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/issue24

[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

[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

[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

[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

[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

[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

[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

[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/i

[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/i

[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.pyt

[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==T

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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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