Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 314883 - dev-lang/python:{3.1,3.2}: Segmentation fault on non-module "encodings" directory on PYTHONPATH
Summary: dev-lang/python:{3.1,3.2}: Segmentation fault on non-module "encodings" direc...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Python Gentoo Team
URL: http://bugs.python.org/issue8766
Whiteboard: 3.1.2-r4
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2010-04-12 19:50 UTC by Miroslav Los
Modified: 2010-07-12 19:32 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miroslav Los 2010-04-12 19:50:08 UTC
dev-lang/python-3.1.2-r2 segfaults on initialization when a non-module directory encodings (i.e. without __init__.py) is encountered on PYTHONPATH. 
It is caused by the use of not yet initialized variable _filters in module _warnings (trying to warn that encodings is not a module).

Also reported on debian at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=575911

Reproducible: Always

Steps to Reproduce:
$ cd /tmp
$ mkdir encodings
$ PYTHONPATH=$PWD python3

Actual Results:  
Segmentation fault

Expected Results:  
No Segmentation fault

$ PYTHONPATH=$PWD gdb python3
...
(gdb) run                                                                                                        
Starting program: /usr/bin/python3                                                                               
Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7ac4993 in get_filter (category=0x7ffff7d8de60, message=0x7ffff7fb9d60, filename=0x7ffff7fbf6f8, lineno=1, module=0x7ffff7fbf6f8, registry=0x640660,
    sourceline=0x0) at Python/_warnings.c:119
119         if (!PyList_Check(_filters)) {
(gdb) print _filters
$1 = (PyObject *) 0x0
(gdb) bt
#0  0x00007ffff7ac4993 in get_filter (category=0x7ffff7d8de60, message=0x7ffff7fb9d60, filename=0x7ffff7fbf6f8, lineno=1, module=0x7ffff7fbf6f8, registry=0x640660,
    sourceline=0x0) at Python/_warnings.c:119
#1  warn_explicit (category=0x7ffff7d8de60, message=0x7ffff7fb9d60, filename=0x7ffff7fbf6f8, lineno=1, module=0x7ffff7fbf6f8, registry=0x640660, sourceline=0x0)
    at Python/_warnings.c:352
#2  0x00007ffff7ac5857 in do_warn (message=0x7ffff7f44810, category=0x7ffff7d8de60, stack_level=<value optimized out>) at Python/_warnings.c:604
#3  0x00007ffff7ac5c3b in PyErr_WarnEx (category=0x7ffff7d8de60, text=<value optimized out>, stack_level=1) at Python/_warnings.c:727
#4  0x00007ffff7af77b5 in find_module (fullname=0x7fffffffa640 "encodings", subname=<value optimized out>, path=0x7ffff7fb79e0, buf=0x7fffffff9570 "/tmp/encodings",
    buflen=4097, p_fp=0x7fffffffa580, p_loader=0x7fffffffa588) at Python/import.c:1468
#5  0x00007ffff7af9ffb in import_submodule (mod=0x7ffff7d94e30, subname=0x7fffffffa640 "encodings", fullname=0x7fffffffa640 "encodings") at Python/import.c:2614
#6  0x00007ffff7afa131 in load_next (mod=0x7ffff7d94e30, altmod=0x7ffff7d94e30, p_name=<value optimized out>, buf=0x7fffffffa640 "encodings",
    p_buflen=0x7fffffffb658) at Python/import.c:2429
#7  0x00007ffff7afa82c in import_module_level (name=0x0, globals=<value optimized out>, locals=<value optimized out>, fromlist=0x7ffff7faaf38, level=0)
    at Python/import.c:2146
#8  0x00007ffff7afb555 in PyImport_ImportModuleLevel (name=0x7ffff7f450b0 "encodings", globals=0x640540, locals=0x640540, fromlist=0x7ffff7faaf38, level=0)
    at Python/import.c:2197
#9  0x00007ffff7adecfd in builtin___import__ (self=<value optimized out>, args=<value optimized out>, kwds=<value optimized out>) at Python/bltinmodule.c:185
#10 0x00007ffff7a61ffc in PyObject_Call (func=0x7ffff7fa65a8, arg=0x7ffff7fb49b0, kw=0x0) at Objects/abstract.c:2160
#11 0x00007ffff7a620fb in call_function_tail (callable=0x7ffff7fa65a8, args=0x7ffff7fb49b0) at Objects/abstract.c:2192
#12 0x00007ffff7a62602 in PyObject_CallFunction (callable=0x7ffff7fa65a8, format=<value optimized out>) at Objects/abstract.c:2216
#13 0x00007ffff7afb68b in PyImport_Import (module_name=0x7ffff7f447d8) at Python/import.c:2804
#14 0x00007ffff7afb845 in PyImport_ImportModule (name=<value optimized out>) at Python/import.c:2057
#15 0x00007ffff7af006e in _PyCodecRegistry_Init () at Python/codecs.c:1060
#16 0x00007ffff7af0345 in _PyCodec_Lookup (encoding=0x621860 "\002") at Python/codecs.c:116
#17 0x00007ffff7b06759 in get_codeset (install_sigs=1) at Python/pythonrun.c:147
#18 Py_InitializeEx (install_sigs=1) at Python/pythonrun.c:274
#19 0x00007ffff7b158eb in Py_Main (argc=1, argv=0x603010) at Modules/main.c:495
#20 0x0000000000400ece in main (argc=1, argv=0x7fffffffdb68) at ./Modules/python.c:170
Comment 1 Andreas K. Hüttel archtester gentoo-dev 2010-04-12 21:49:23 UTC
Please attach the output of emerge --info
Comment 2 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-04-13 15:03:14 UTC
It should be rather reported to upstream.
Comment 3 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-07-12 18:03:19 UTC
3.1: r351
Comment 4 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-07-12 19:32:09 UTC
Fixed in 3.1.2-r4.