[issue43047] logging.config formatters documentation is out of sync with code

2021-01-27 Thread Ian Wienand


Change by Ian Wienand :


--
keywords: +patch
pull_requests: +23182
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24358

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



[issue43047] logging.config formatters documentation is out of sync with code

2021-01-27 Thread Ian Wienand


New submission from Ian Wienand :

The dict based configuration does not mention the "class" option, and neither 
the ini-file or dict sections mention the style tag.

--
components: Library (Lib)
messages: 385825
nosy: iwienand
priority: normal
severity: normal
status: open
title: logging.config formatters documentation is out of sync with code
type: enhancement

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



[issue31426] Segfault during GC of generator object; invalid gi_frame?

2017-09-12 Thread Ian Wienand

New submission from Ian Wienand:

Using 3.5.2-2ubuntu0~16.04.3 (Xenial) we see an occasional segfault during 
garbage collection of a generator object

A full backtrace is attached, but the crash appears to be triggered inside 
gen_traverse during gc

---
(gdb) info args
gen = 0x7f22385f0150
visit = 0x50eaa0 
arg = 0x0

(gdb) print *gen
$109 = {ob_base = {ob_refcnt = 1, ob_type = 0xa35760 }, gi_frame = 
0x386aed8, gi_running = 1 '\001', gi_code = , 
gi_weakreflist = 0x0, gi_name = 'linesplit', gi_qualname = 'linesplit'}
---

I believe gen_traverse is doing the following

---
static int
gen_traverse(PyGenObject *gen, visitproc visit, void *arg)
{
Py_VISIT((PyObject *)gen->gi_frame);
Py_VISIT(gen->gi_code);
Py_VISIT(gen->gi_name);
Py_VISIT(gen->gi_qualname);
return 0;
}
---

The problem here being that this generator's gen->gi_frame has managed to 
acquire a NULL object type but still has references

---
(gdb) print *gen->gi_frame
$112 = {ob_base = {ob_base = {ob_refcnt = 2, ob_type = 0x0}, ob_size = 0}, 
f_back = 0x0, f_code = 0xca3e4fd8950fef91, ...
---

Thus it gets visited and it doesn't go well.

I have attached the py-bt as well, it's very deep with ansible, multiprocessing 
forking, imp.load_source() importing ... basically a nightmare.  I have not 
managed to get it down to any sort of minimal test case unfortunately.  This 
happens fairly infrequently, so suggests a race.  The generator in question has 
a socket involved:

---
def linesplit(socket):
buff = socket.recv(4096).decode("utf-8")
buffering = True
while buffering:
if "\n" in buff:
(line, buff) = buff.split("\n", 1)
yield line + "\n"
else:
more = socket.recv(4096).decode("utf-8")
if not more:
buffering = False
else:
buff += more
if buff:
yield buff
---

Wild speculation but maybe something to do with finalizing generators with 
file-descriptors across fork()?

At this point we are trying a work-around of not having the above socket 
reading routine in a generator but just a "regular" loop.  As it triggers as 
part of a production roll-out I'm not sure we can do too much more debugging.  
Unless this rings any immediate bells for people, we can probably just have 
this for tracking at this point.  [1] is the original upstream issue
 
[1] https://storyboard.openstack.org/#!/story/2001186#comment-17441

--
components: Interpreter Core
files: crash-bt.txt
messages: 301943
nosy: iwienand
priority: normal
severity: normal
status: open
title: Segfault during GC of generator object; invalid gi_frame?
type: crash
versions: Python 3.5
Added file: https://bugs.python.org/file47134/crash-bt.txt

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



[issue31426] Segfault during GC of generator object; invalid gi_frame?

2017-09-12 Thread Ian Wienand

Changes by Ian Wienand <i...@wienand.org>:


Added file: https://bugs.python.org/file47135/crash-py-bt.txt

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-07 Thread Ian Wienand

Ian Wienand added the comment:

I'm not sure what systems are defined as critical or not.

Although python is not really installable/configurable by end-users on ESXi, I 
noticed during development because we use python very early in the boot, before 
/dev/urandom appears for us (it comes from a kernel module loaded later).

--

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-07-12 Thread Ian Wienand

New submission from Ian Wienand i...@wienand.org:

Hi,

Lib/random.py has a fallback if os.urandom() returns NotImplementedError

---
from os import urandom as _urandom
...
   def seed(self, a=None):
if a is None:
try:
a = long(_hexlify(_urandom(16)), 16)
except NotImplementedError:
import time
a = long(time.time() * 256) # use fractional seconds
---

In 2.6, this is indeed what happens in Lib/os.py where import urandom from os 
gets [2]:

---
if not _exists(urandom):
def urandom(n):
...
  try:
_urandomfd = open(/dev/urandom, O_RDONLY)
except (OSError, IOError):
raise NotImplementedError(/dev/urandom (or equivalent) not found)
---

however, in 2.7, things have shuffled around as a result of issue Issue #13703 
and now _PyOS_URandom will return an OSError if it can't find /dev/urandom [3].

This means if you import random without /dev/urandom available it crashes 
trying to seed

I'm not sure if this is intentional?  One easy solution would be to catch 
OSError in random.py and fall back then too

[1] http://hg.python.org/cpython/file/70274d53c1dd/Python/random.c#l227
[2] http://hg.python.org/cpython/file/9f8771e09052/Lib/os.py#l746
[3] http://hg.python.org/cpython/file/70274d53c1dd/Lib/random.py#l111

--
components: Library (Lib)
messages: 165340
nosy: iwienand
priority: normal
severity: normal
status: open
title: OSError with import random when /dev/urandom doesn't exist (regression 
from 2.6)
versions: Python 2.7

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



[issue12059] hashlib does not handle missing hash functions correctly

2011-05-11 Thread Ian Wienand

New submission from Ian Wienand i...@wienand.org:

If one of the hash functions isn't defined in _hashlib, the code suggests it 
should just be skipped

===
  # this one has no builtin implementation, don't define it
pass
===

This doesn't happen however; due to ImportError not being caught the module 
decides the whole _hashlib module isn't available and tries to fall back to the 
older individual libraries.  You then get thrown an unrelated error about _md5 
being unavailable

You can easily replicate this

---
$ python
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) 
[GCC 4.4.5] on linux2
Type help, copyright, credits or license for more information.
 def foo():
... raise ValueError
... 
 import _hashlib
 _hashlib.openssl_sha224 = foo
 import hashlib
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.6/hashlib.py, line 136, in module
md5 = __get_builtin_constructor('md5')
  File /usr/lib/python2.6/hashlib.py, line 63, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
 
---

I think the solution is to catch the ImportError in __get_builtin_constructor 
and, if caught, consider the hash function unsupported

--
files: hashlib.py.diff
keywords: patch
messages: 135794
nosy: Ian.Wienand
priority: normal
severity: normal
status: open
title: hashlib does not handle missing hash functions correctly
type: behavior
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file21971/hashlib.py.diff

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