[issue13405] Add DTrace probes

2012-02-21 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Jesús said he was focusing on Solaris and couldn't help with OS X. Not sure if 
anyone else was going to try tackling that...

Just tried the patch `issue13405_4027.diff` on OS X 10.6.8.

First problem I ran into was:

gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
-I. -I./Include-DPy_BUILD_CORE -o ./Include/phelper_offsets \
./Include/phelper_offsets.c
./Include/phelper_offsets.c: In function 'main':
./Include/phelper_offsets.c:23: warning: format '%d' expects type 'int', but 
argument 2 has type 'long int'
./Include/phelper_offsets.c:26: warning: format '%d' expects type 'int', but 
argument 2 has type 'long unsigned int'
./Include/phelper_offsets.c:28: warning: implicit declaration of function 
'offsetof'
./Include/phelper_offsets.c:28: error: expected expression before 
'PyCompactUnicodeObject'
./Include/phelper_offsets.c:30: error: expected expression before 
'PyCompactUnicodeObject'
make: *** [Include/phelper_offsets.h] Error 1

OS X seems to have `offsetof` defined in `stddef.h` -- adding `#include 
` got this to compile.

The next problem was with: 

```
if test "dtrace" != "" ; then \
dtrace -o Python/phelper.o -DPHELPER -64 \
-I. -I./Include   -C -G -s ./Include/phelper.d ; \
elsetouch Python/phelper.o ; \
fi;
```

This fails because DTrace on OS X doesn't have the -G option. Removing the `-G` 
(total hack since it seems like `-G` is not at all a trivial option) results in:

```
dtrace: failed to initialize dtrace: DTrace requires additional privileges
```

Adding `sudo` isn't a practical solution, but I tried it to see if it would 
help or if there would be other errors and there was another error:

```
dtrace: ignored option -- 64
/dev/fd/5:42:8: warning: undefining "__STDC__"
dtrace: failed to compile script ./Include/phelper.d: 
"/usr/include/libkern/_OSByteOrder.h", line 98: specified storage class not 
appropriate in D
make: *** [Python/phelper.o] Error 1
```

--
nosy: +Marc.Abramowitz

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



[issue13405] Add DTrace probes

2012-02-22 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

With an hg checkout, I don't run into the `offsetof` problem - it fails when it 
gets to calling dtrace to generate Python/dtrace.o (again -G is the culprit).

```
$ hg clone https://hg.jcea.es/cpython-2011/
$ cd cpython-2011
$ hg update dtrace-issue13405_2.7
$ ./configure --prefix=/Users/marca/custom --enable-shared --with-dtrace
...
$ make
...
$ make
if test "dtrace" != "" ; then \
dtrace -o Python/dtrace.o -64 \
-C -G -s ./Include/pydtrace.d \
Python/ceval.o Modules/gcmodule.o \
Objects/classobject.o Objects/typeobject.o; \
elsetouch Python/dtrace.o ; \
fi;
dtrace: ignored option -- 64
Usage: dtrace [-aACeFHlqSvVwZ] [-arch i386|x86_64] [-b bufsz] [-c cmd] [-D 
name[=def]]
[-I path] [-L path] [-o output] [-p pid] [-s script] [-U name]
[-x opt[=val]]
...
```

--

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



[issue13405] Add DTrace probes

2012-02-22 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

My understanding of DTrace is extremely shallow, but I think there is a major 
difference in how USDT probes are created between Solaris and OS X. Whereas on 
Solaris one generates object code using the -G option of dtrace and then links 
it in with the application, it seems that on OS X, the header file that dtrace 
-h spits out already has the magic assembler voodoo in it and thus you don't 
link with anything extra for DTrace. If that's true, then we probably need 
Makefile ifdef stuff to make it work.

If someone can verify my theories, I might be inclined to take a stab at it.

--

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



[issue13405] Add DTrace probes

2012-02-22 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

I noticed that jcea already had some commented out stuff for OS X in his 
configure.in.

I tried it out and stuff builds and works in a basic way, although it might not 
be fully functional.

```
~/src/python-hg/cpython-2011$ hg diff configure.in
diff -r b50130b35288 configure.in
--- a/configure.in  Wed Feb 22 02:15:47 2012 +0100
+++ b/configure.in  Wed Feb 22 14:19:42 2012 -0800
@@ -2670,8 +2670,7 @@
 DFLAGS="-32"
 fi
 
-#if dtrace -G -o /dev/null Include/pydtrace.d 2>/dev/null
-if true
+if dtrace -G -o /dev/null Include/pydtrace.d 2>/dev/null
 then
 DTRACE_NM=SOLARIS
 AC_DEFINE(WITH_DTRACE, 1,
```

```
~/src/python-hg/cpython-2011$ ./configure --prefix=/Users/marca/custom 
--enable-shared --with-dtrace
...
~/src/python-hg/cpython-2011$ make
...
~/src/python-hg/cpython-2011$ DYLD_LIBRARY_PATH=. python2.7
Python 2.7.2+ (dtrace-issue13405_2.7:b50130b35288+, Feb 22 2012, 14:11:17) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getpid()
34764

# In another tab...
$ sudo dtrace -l | grep python34764
124748 python34764 libpython2.7.dylibPyEval_EvalFrameExReal 
function-entry
124749 python34764 libpython2.7.dylibPyEval_EvalFrameExReal 
function-return
124750 python34764 libpython2.7.dylib   collect gc-done
124751 python34764 libpython2.7.dylib   collect gc-start
124752 python34764 libpython2.7.dylib   subtype_dealloc 
instance-delete-done
124753 python34764 libpython2.7.dylib  instance_dealloc 
instance-delete-done
124754 python34764 libpython2.7.dylib   subtype_dealloc 
instance-delete-start
124755 python34764 libpython2.7.dylib  instance_dealloc 
instance-delete-start
124756 python34764 libpython2.7.dylib   PyType_GenericAlloc 
instance-new-done
124757 python34764 libpython2.7.dylibPyInstance_New 
instance-new-done
124758 python34764 libpython2.7.dylib   PyType_GenericAlloc 
instance-new-start
124759 python34764 libpython2.7.dylibPyInstance_New 
instance-new-start
124760 python34764 libpython2.7.dylibPyEval_EvalFrameExReal line
```

So it builds and works at a basic level.

However, I did see some weirdness as well:

```
$ sudo dtrace -n 'python34764::: { printf("%s (%s:%d)", copyinstr(arg1), 
copyinstr(arg0), arg2) }' | grep test
dtrace: description 'python34764::: ' matched 13 probes
dtrace: error on enabled probe ID 4 (ID 124751: 
python34764:libpython2.7.dylib:collect:gc-start): invalid address (0x2) in 
action #2 at DIF offset 24
dtrace: error on enabled probe ID 3 (ID 124750: 
python34764:libpython2.7.dylib:collect:gc-done): invalid address 
(0xfffb) in action #1 at DIF offset 24
```

and

```
~/src/python-hg/cpython-2011$ sudo DYLD_LIBRARY_PATH=. dtrace -n 'python*::: { 
printf("%s (%s:%d)", copyinstr(arg1), copyinstr(arg0), arg2) }' -c 'python2.7 
/Users/marca/python/test.py' > /dev/null
dtrace: description 'python*::: ' matched 29 probes
dtrace: pid 34907 has exited
dtrace: error on enabled probe ID 20 (ID 126731: 
python34907:libpython2.7.dylib:collect:gc-start): invalid address (0x2) in 
action #2 at DIF offset 24
dtrace: error on enabled probe ID 19 (ID 126730: 
python34907:libpython2.7.dylib:collect:gc-done): invalid address 
(0xfffb) in action #1 at DIF offset 24
```

On the other hand, some stuff appears to work sometimes:

```
~/src/python-hg/cpython-2011$ sudo DYLD_LIBRARY_PATH=. dtrace -n 
'python*:::function-entry { printf("%s (%s:%d)", copyinstr(arg1), 
copyinstr(arg0), arg2) }' -c 'python2.7 /Users/marca/python/test.py'
dtrace: description 'python*:::function-entry ' matched 9 probes
Current working directory: /Users/marca/src/python-hg/cpython-2011
11
Current working directory: /Users/marca/src/python-hg/cpython-2011
11
Current working directory: /Users/marca/src/python-hg/cpython-2011
11
dtrace: pid 34953 has exited
CPU IDFUNCTION:NAME
  2 125639 PyEval_EvalFrameExReal:function-entry  
(/Users/marca/python/test.py:1)
  2 125639 PyEval_EvalFrameExReal:function-entry  
(/Users/marca/python/marcsmath.py:1)
  2 125639 PyEval_EvalFrameExReal:function-entry test_func 
(/Users/marca/python/test.py:4)
  2 125639 PyEval_EvalFrameExReal:function-entry add 
(/Users/marca/python/marcsmath.py:1)
  2 125639 PyEval_EvalFrameExReal:function-entry test_func 
(/Users/marca/python/test.py:4)
  2 125639 PyEval_EvalFrameExReal:function-entry add 
(/Users/marca/python/marcsmath.py:1)
  2 125639 PyEval_EvalFrameExReal:function-entry test_func 
(/Users

[issue13405] Add DTrace probes

2012-02-26 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Hi Jesús,

Yes, I'm on an x86 machine. A MacBook Pro with OS X 10.6.8.

I'll try to hop on Google Talk during the week. I'm on the west coast of the 
U.S. (GMT-8) so it might be tricky to find a mutually good time.

Here's the result of the tests - like you said the stack test failed but 
everything else passed:

```
[last: 0] marca@SCML-MarcA:~/src/python-hg/cpython-2011$ sudo 
~/custom/bin/python Lib/test/test_dtrace.py 
test_function_entry_return (__main__.DTraceTestsNormal) ... ok
test_garbage_collection (__main__.DTraceTestsNormal) ... ok
test_instance_creation_destruction (__main__.DTraceTestsNormal) ... ok
test_line (__main__.DTraceTestsNormal) ... ok
test_stack (__main__.DTraceTestsNormal) ... FAIL
test_verify_opcodes (__main__.DTraceTestsNormal) ... ok

==
FAIL: test_stack (__main__.DTraceTestsNormal)
...
```

Perhaps the test should be modified as follows:

```
[last: 0] marca@SCML-MarcA:~/src/python-hg/cpython-2011$ hg diff 
Lib/test/test_dtrace.py
diff -r b50130b35288 Lib/test/test_dtrace.py
--- a/Lib/test/test_dtrace.py   Wed Feb 22 02:15:47 2012 +0100
+++ b/Lib/test/test_dtrace.py   Sun Feb 26 22:56:03 2012 -0800
@@ -78,6 +78,9 @@
 self.assertEqual(actual_result, expected_result)
 
 def test_stack(self) :
+if sys.platform == 'darwin':
+raise unittest.SkipTest, "No jstack support on Mac OS X"
+
 dscript = """
 python$target:::function-entry
 /(copyinstr(arg0)=="%(path)s") &&
```

Then the result is:

```
[last: 0] marca@SCML-MarcA:~/src/python-hg/cpython-2011$ sudo 
~/custom/bin/python Lib/test/test_dtrace.py 
test_function_entry_return (__main__.DTraceTestsNormal) ... ok
test_garbage_collection (__main__.DTraceTestsNormal) ... ok
test_instance_creation_destruction (__main__.DTraceTestsNormal) ... ok
test_line (__main__.DTraceTestsNormal) ... ok
test_stack (__main__.DTraceTestsNormal) ... skipped 'No jstack support on Mac 
OS X'
test_verify_opcodes (__main__.DTraceTestsNormal) ... ok

--
Ran 6 tests in 0.561s

OK (skipped=1)
test_function_entry_return (__main__.DTraceTestsOptimize) ... ok
test_garbage_collection (__main__.DTraceTestsOptimize) ... ok
test_instance_creation_destruction (__main__.DTraceTestsOptimize) ... ok
test_line (__main__.DTraceTestsOptimize) ... ok
test_stack (__main__.DTraceTestsOptimize) ... skipped 'No jstack support on Mac 
OS X'
test_verify_opcodes (__main__.DTraceTestsOptimize) ... ok

--
Ran 6 tests in 0.577s

OK (skipped=1)
```

By the way, I have some virtual machines set up for OpenIndiana b151A and 
FreeBSD 9.0, so you need some testing on those platforms, let me know.

--

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



[issue13405] Add DTrace probes

2012-02-26 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

All tests pass on OpenIndiana b151A (SunOS openindiana 5.11 oi_151a2 i86pc i386 
i86pc Solaris).

--

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



[issue13405] Add DTrace probes

2012-02-27 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

I get a build error on FreeBSD 9.0:

make: don't know how to make ./Include/phelper_offsets.h. Stop

Any ideas?

--

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



[issue13405] Add DTrace probes

2012-02-27 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Re my comment in #154513, the following seems to fix that problem on FreeBSD 
9.0:


[marca@freebsd9-0 ~/src/cpython-2011]$ hg diff Makefile.pre.in
diff -r 70dc1e48bd7f Makefile.pre.in
--- a/Makefile.pre.in   Mon Feb 27 22:43:17 2012 +0100
+++ b/Makefile.pre.in   Mon Feb 27 14:20:18 2012 -0800
@@ -632,7 +632,7 @@
elsetouch $@ ; \
fi;
 
-Include/phelper_offsets.h: $(srcdir)/Include/phelper_offsets.c 
$(srcdir)/Python/ceval.o
+$(srcdir)/Include/phelper_offsets.h: $(srcdir)/Include/phelper_offsets.c 
$(srcdir)/Python/ceval.o
$(CC) $(PY_CFLAGS) -o $(srcdir)/Include/phelper_offsets \
$(srcdir)/Include/phelper_offsets.c
$(srcdir)/Include/phelper_offsets.sh $(DTRACE_NM) \

I'm now struggling with some other errors:

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes  -I. -IInclude -I./Include  -DPy_BUILD_CORE  -c 
./Modules/xxsubtype.c -o Modules/xxsubtype.o
if test "dtrace" != "" ; then  dtrace -o Python/dtrace.o -64  -C -G -s 
./Include/pydtrace.d  Python/ceval.o Modules/gcmodule.o  Objects/classobject.o 
Objects/typeobject.o;  elsetouch Python/dtrace.o ;  fi;
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes  -I. -IInclude -I./Include  -DPy_BUILD_CORE -o 
./Include/phelper_offsets  ./Include/phelper_offsets.c
./Include/phelper_offsets.sh OTHER  ./Python/ceval.o ./Include/phelper_offsets 
>  ./Include/phelper_offsets.h
if test "dtrace" != "" ; then  dtrace -o Python/phelper.o -DPHELPER -64  -I. 
-IInclude -I./Include -C -G -s ./Include/phelper.d ;  else touch 
Python/phelper.o ;  fi;
dtrace: failed to compile script ./Include/phelper.d: line 3: useless 
declaration
*** Error code 1

--

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



[issue13405] Add DTrace probes

2012-02-28 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Limiting to 10.6 and above seems entirely reasonable to me. I am one of the few 
folks that I know who is still on 10.6. Most of my friends are on 10.7.

Since OS X is primarily a desktop OS, I think people tend to upgrade more 
quickly compared to more of a server OS like Solaris. For instance, I stayed on 
10.5 for a while but was eventually forced to upgrade to 10.6, because I wanted 
to do iOS development and the Xcode and developer SDK needed to do that 
required 10.6. That right there kind of tells you that even Apple is not really 
supporting 10.5 for development.

Also, if you target 10.6, I can test it for you. If you target 10.5, I don't 
have a 10.5 machine to test with.

So if it's at all hard to support 10.5, I'd say skip it and someone else can do 
it if they really need it. But I doubt that will happen.

--

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



[issue13405] Add DTrace probes

2012-02-28 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

I wanted to post an update on FreeBSD 9.0, which Jesús and I worked on a bit 
yesterday.

Maybe Jordan will chime in here with an answer to my FreeBSD problems. :-)

With a little bit of Makefile hackery (make it skip building the phelper stuff 
which was failing with a "useless declaration" error and which is for jstack 
which might not be supported on FreeBSD), I got Python to build with Jesús's 
patches.

But I couldn't actually dtrace anything with it.

And then I stepped back and tried to dtrace other programs to see if userland 
DTrace was working and I ran into all kinds of problems, including killing the 
traced program and a (reproduceable) kernel panic. Here's a question that I 
posted about it on the FreeBSD-questions mailing list:

http://lists.freebsd.org/pipermail/freebsd-questions/2012-February/238862.html

If I can get the FreeBSD DTrace support working without too much effort, then 
I'll do it, but if it's problematic, then I might skip it and focus on helping 
Jesús test his stuff on OS X and OpenIndiana.

--

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



[issue13405] Add DTrace probes

2012-02-28 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

[marca@freebsd9-0 ~]$ /home/marca/custom/bin/python
Python 2.7.2+ (dtrace-issue13405_2.7:e612f29478e3+, Feb 27 2012, 20:37:22) 
[GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd9
Type "help", "copyright", "credits" or "license" for more information.
>>> 
[marca@freebsd9-0 ~]$ sudo dtrace -n 'pid$target:python::entry' -c 
/home/marca/custom/bin/python
Python 2.7.2+ (dtrace-issue13405_2.7:e612f29478e3+, Feb 27 2012, 20:37:22) 
[GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd9
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getpid()
2541
>>> 
dtrace: failed to control pid 2541: process exited with status 0


[marca@freebsd9-0 ~]$ ps auxww | grep python
marca   2546   0.0  2.3  27452   5668   1  S+3:29AM   0:00.02 
/home/marca/custom/bin/python
[marca@freebsd9-0 ~]$ sudo dtrace -n 'pid2546:python::entry'
[marca@freebsd9-0 ~]$ ps auxww | grep python
marca   2552   0.0  0.5  16460   1244   0  S+3:29AM   0:00.00 grep 
python

In the above case, the python proces (pid 2546) died with:

>>> Killed: 9

Why would DTrace kill -9 the program it's tracing?

--

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



[issue13405] Add DTrace probes

2012-02-28 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

For anyone who is curious about the FreeBSD 9.0 DTrace userland problems I 
experienced, see http://www.freebsd.org/cgi/query-pr.cgi?pr=165541

--

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



[issue13405] Add DTrace probes

2012-03-25 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Hey Jesús,

Let me know if you need any additional help testing.

Marc

--

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



[issue14572] 2.7.3: sqlite module does not build on centos 5

2012-04-23 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

This patch worked for me as well. Thanks, Joakim!

$ cat /etc/redhat-release 
CentOS release 5.5 (Final)

--
nosy: +Marc.Abramowitz

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



[issue1436] logging.config.fileConfig, NameError: name 'RotatingFileHandler' is not defined

2012-05-18 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

I just ran into this issue with Python 2.5 (doesn't seem to be an issue in >= 
2.6?) and for the benefit of anyone else, I'm copying the answer from `Vinay's 
Google Group post 
<http://groups.google.com/group/comp.lang.python/browse_thread/thread/21be57fae7e9381a>`
 into this bug, in case the Google group goes away or the URL changes.

The values in the config file are interpreted in the context of the
logging module's namespace. Hence, one way of achieving what you 
want is putting any custom handlers in a module of your own, and
providing a binding in the logging module's namespace. For example: 
assuming your DBHandler is defined in a module customhandlers, you 
could do this somewhere in your code, before loading the 
configuration:

import logging
import customhandlers # Use your own module name here

logging.custhandlers = customhandlers # Bind your module to 
"custhandlers" in logging

and then your logging configuration can refer to 
"custhandlers.DBHandler". Of course I merely used "custhandlers" and 
"customhandlers" to show how you can bind to an arbitrary name.

--
nosy: +Marc.Abramowitz

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



[issue1436] logging.config.fileConfig, NameError: name 'RotatingFileHandler' is not defined

2012-05-18 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Or for a practical example, here's how I used the above technique to solve this 
problem in web2py:

diff --git a/gluon/main.py b/gluon/main.py
index 57bf647..2f69c6b 100644
--- a/gluon/main.py
+++ b/gluon/main.py
@@ -68,6 +68,13 @@ create_missing_folders()
 # set up logging for subsequent imports
 import logging
 import logging.config
+
+# This needed to prevent exception on Python 2.5:
+# NameError: name 'gluon' is not defined
+# See http://bugs.python.org/issue1436
+import gluon.messageboxhandler
+logging.gluon = gluon
+
 logpath = abspath("logging.conf")
 if os.path.exists(logpath):
 logging.config.fileConfig(abspath("logging.conf"))

--

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



[issue14572] 2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4

2012-05-18 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Just to make this a tad easier, I put Joakim's patch into a gist:

[marca@logger01.prod1 Python-2.7.3]$ pwd
/home/marca/src/Python-2.7.3

[marca@logger01.prod1 Python-2.7.3]$ curl -sk 
https://raw.github.com/gist/2727063/ | patch -p1
patching file Modules/_sqlite/connection.c

I suppose this could be fixed in the Python code with some autoconf stuff, but 
I'm not too comfortable with autoconf.

--

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



[issue14572] 2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4

2012-05-18 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

curl -sk https://raw.github.com/gist/2727063/ | patch -p1

--

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



[issue14572] 2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4

2012-05-19 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

OK, here's a patch for configure.ac which seems to fix this problem -- if folks 
could review and test it that would be great.

--
keywords: +patch
Added file: http://bugs.python.org/file25634/sqlite3_int64.patch

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



[issue14859] Patch to make IDLE window rise to top in OS X on launch

2012-05-19 Thread Marc Abramowitz

New submission from Marc Abramowitz :

On OS X 10.6.8, when I execute "idle", I see nothing in the Terminal and the 
IDLE GUI launches but is not visible until I Command-Tab to the "Python" 
application. I stumbled upon a solution to this problem using OS X's built-in 
/usr/bin/osascript utility. Attaching a patch...

--
components: IDLE
files: osx_raise_idle.patch
keywords: patch
messages: 161137
nosy: Marc.Abramowitz
priority: normal
severity: normal
status: open
title: Patch to make IDLE window rise to top in OS X on launch
type: enhancement
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file25639/osx_raise_idle.patch

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



[issue14859] Patch to make IDLE window rise to top in OS X on launch

2012-05-19 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

I created the patch against the 2.7 branch of hg, but I just tried it with both 
the 3.2 branch of hg and an installed version of 3.2 and it worked great.

[last: 0] marca@scml-marca:~/dev/hg-repos/cpython$ pushd 
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/ > 
/dev/null
[last: 0] 
marca@scml-marca:/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib$
 patch -p3 < osx_raise_idle.patch 
patching file PyShell.py
Hunk #1 succeeded at 1433 (offset -25 lines).

--

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



[issue11571] Turtle window pops under the terminal on OSX

2012-05-19 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

I wonder if this could be applied at some lower level in TkInter, because this 
bug happens with every Tk app -- e.g.: turtle, idle, web2py

--
nosy: +Marc.Abramowitz

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



[issue14860] devguide: Clarify how to run cpython test suite - esp. on 2.7

2012-05-19 Thread Marc Abramowitz

New submission from Marc Abramowitz :

The way to test on Python 2.7 (discovered on IRC) is:

~/dev/hg-repos/cpython$ ./python.exe -m test.regrtest -j3

This is not documented. I will submit a patch...

--
components: Devguide
files: devguide.patch
keywords: patch
messages: 161155
nosy: Marc.Abramowitz, ezio.melotti
priority: normal
severity: normal
status: open
title: devguide: Clarify how to run cpython test suite - esp. on 2.7
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file25641/devguide.patch

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



[issue14860] devguide: Clarify how to run cpython test suite - esp. on 2.7

2012-05-19 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Revising per feedback from Taggnostr on IRC.

--
Added file: http://bugs.python.org/file25643/devguide-1.patch

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



[issue14572] 2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4

2012-05-19 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

My guess would be that the code was switched to use the new typedef because the 
SQLite docs say they're preferred. 

http://www.sqlite.org/c3ref/int64.html

Maybe they are planning to deprecate the old typedef at some point?

--

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



[issue14572] 2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4

2012-05-19 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Probably either approach will have the exact same effect for the foreseeable
future, so I don't feel strongly either way. It would be nice to have one of 
them so folks can have a sqlite3 module without having to search around and 
apply patches. Big win.

--

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



[issue14861] (Patch included) Make ./python -m test work to run test suite in Python 2.7

2012-05-19 Thread Marc Abramowitz

New submission from Marc Abramowitz :

Currently, the devguide (http://docs.python.org/devguide/) mentions two sets of 
commands for running the CPython test suite:

* For Python 3, one uses: ./python -m test

* For Python 2.7, one must use: ./python -m test.regrtest because ./python -m 
test fails with an error:No module named test.__main__; 'test' is a package and 
cannot be directly executed

If you take these two variations and multiply by the 3 variations of "python" 
command required depending on the OS (Windows, OS X, or other), then there are 
6 permutations. I would say that this doesn't exactly encourage newcomers to 
CPython to contribute.

To take away a bit of the complexity, I have an extremely simple patch that 
adds one two line file to make ./python -m test work on 2.7.

--
components: Tests
files: python2.7_test.patch
keywords: patch
messages: 161180
nosy: Marc.Abramowitz
priority: normal
severity: normal
status: open
title: (Patch included) Make ./python -m test work to run test suite in Python 
2.7
versions: Python 2.7
Added file: http://bugs.python.org/file25648/python2.7_test.patch

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



[issue14572] 2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4

2012-05-20 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Ned, thanks for applying this patch!

--

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



[issue14982] pkgutil.walk_packages seems to not work properly on Python 3.3a

2012-06-01 Thread Marc Abramowitz

New submission from Marc Abramowitz :

I noticed that pip wasn't working properly on Python 3.3a - notably, it wasn't 
able to load any of its own VCS modules -- it does this by using 
pkgutil.walk_packages

I think the problem is that the behavior of pkgutil.walk_packages changed in 
some incompatible way in 3.3 -- take a look at the following:

[last: 0] marca@scml-marca:~/dev/git-repos/lexicon$ 
../lexicon/.tox/py32/bin/python
Python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:25:50) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pkgutil import walk_packages
>>> list(walk_packages('/Users/marca/dev/git-repos/lexicon/.tox/py33/lib/python3.3/site-packages/pip-1.1-py3.3.egg/pip/vcs'))
[(, 'lexicon', True), 
(, 'lexicon.alias_dict', False), 
(, 'lexicon.attribute_dict', False), 
(, 'reg_settings', False), 
(, 'setup', False)]
>>> ^D

[last: 10] marca@scml-marca:~/dev/git-repos/lexicon$ 
../lexicon/.tox/py33/bin/python
Python 3.3.0a3 (v3.3.0a3:0b53b70a40a0, May  1 2012, 11:39:35) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pkgutil import walk_packages
>>> list(walk_packages('/Users/marca/dev/git-repos/lexicon/.tox/py33/lib/python3.3/site-packages/pip-1.1-py3.3.egg/pip/vcs'))
[]

--
components: Library (Lib)
messages: 162110
nosy: Marc.Abramowitz
priority: normal
severity: normal
status: open
title: pkgutil.walk_packages seems to not work properly on Python 3.3a
versions: Python 3.3

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



[issue14982] pkgutil.walk_packages seems to not work properly on Python 3.3a

2012-06-01 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Here's the pip issue: https://github.com/pypa/pip/issues/556

--

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



[issue14982] pkgutil.walk_packages seems to not work properly on Python 3.3a

2012-06-01 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

[last: 0] marca@scml-marca:~/dev/git-repos/pip$ python3.3
Python 3.3.0a4 (v3.3.0a4:7c51388a3aa7, May 30 2012, 16:58:42) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pip import vcs
>>> from pkgutil import walk_packages, iter_modules
>>> print(list(iter_modules(path=vcs.__path__, prefix=vcs.__name__+'.')))
[]
>>> print(list(iter_modules(path=vcs.__path__)))
[]
>>> import pip.vcs.git
>>> pip.vcs.git

>>> import pip.vcs.mercurial
>>> pip.vcs.mercurial

>>> print(list(iter_modules(path=vcs.__path__, prefix=vcs.__name__+'.')))
[]
>>> print(list(iter_modules(path=vcs.__path__)))
[]

--

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



[issue13405] Add DTrace probes

2012-06-07 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Hi jcea,

Sorry, I've been away from this for a while.

I'm getting undefined symbols now while trying to link:

```

(12:47pm) [last: 0] marca@scml-marca:~/src$ hg clone 
http://hg.python.org/cpython...
(12:55pm) [last: 0] marca@scml-marca:~/src$ cd cpython
[last: 0] marca@scml-marca:~/src/cpython$ hg tip
changeset:   77378:da5b370f41a1
branch:  2.7
tag: tip
user:Richard Oudkerk 
date:Wed Jun 06 19:01:14 2012 +0100
summary: Issue #13854: Properly handle non-integer, non-string arg to 
SystemExit

[last: 0] marca@scml-marca:~/src/cpython$ curl -s 
http://bugs.python.org/file25203/4a072278b866.diff | patch -p1
patching file .hgignore
Hunk #1 succeeded at 81 (offset 8 lines).
patching file Doc/library/debug.rst
patching file Doc/library/dtrace.rst
patching file Include/code.h
patching file Include/pydtrace.d
patching file Include/pydtrace.h
patching file Include/pydtrace_offsets.c
patching file Include/pydtrace_offsets.sh
patching file Lib/test/dtrace_sample.py
patching file Lib/test/test_dtrace.py
patching file Makefile.pre.in
Hunk #2 succeeded at 462 (offset 1 line).
Hunk #3 succeeded at 491 (offset 1 line).
Hunk #4 succeeded at 502 (offset 1 line).
Hunk #5 succeeded at 607 (offset 17 lines).
Hunk #6 succeeded at 733 (offset 19 lines).
Hunk #7 succeeded at 1429 (offset 45 lines).
Hunk #8 succeeded at 1461 (offset 45 lines).
patching file Modules/dtracemodule.c
patching file Modules/gcmodule.c
Hunk #2 FAILED at 791.
Hunk #3 succeeded at 1059 with fuzz 1 (offset 112 lines).
1 out of 3 hunks FAILED -- saving rejects to file Modules/gcmodule.c.rej
patching file Objects/codeobject.c
patching file Objects/frameobject.c
Hunk #1 succeeded at 714 (offset 2 lines).
patching file Objects/typeobject.c
patching file Python/ceval.c
Hunk #9 succeeded at 3149 (offset 7 lines).
Hunk #10 succeeded at 3842 (offset 12 lines).
Hunk #11 succeeded at 3911 (offset 12 lines).
patching file configure
patching file configure.ac
patching file pyconfig.h.in
patching file setup.py
Hunk #1 succeeded at 575 (offset 4 lines).


[last: 0] marca@scml-marca:~/src/cpython$ ./configure --enable-framework && make
...
gcc -o Python.framework/Versions/3.3/Python   -dynamiclib \
  -all_load libpython3.3m.a -Wl,-single_module \
  -install_name 
/Library/Frameworks/Python.framework/Versions/3.3/Python \
  -compatibility_version 3.3 \
  -current_version 3.3 \
  -framework CoreFoundation -ldl  -framework CoreFoundation;
Undefined symbols:
  "_PYTHON_LINE_ENABLED", referenced from:
  _PyEval_EvalFrameEx in libpython3.3m.a(ceval.o)
  _PyEval_EvalFrameEx in libpython3.3m.a(ceval.o)
  _PyEval_EvalFrameEx in libpython3.3m.a(ceval.o)
  _PyEval_EvalFrameEx in libpython3.3m.a(ceval.o)
  _PyEval_EvalFrameEx in libpython3.3m.a(ceval.o)
```

--

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



[issue13405] Add DTrace probes

2012-06-07 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

The 2.7 patch doesn't apply cleanly for me against the latest on the 2.7 branch:

[last: 0] marca@scml-marca:~/src$ hg clone http://hg.python.org/cpython && cd 
cpython && hg update 2.7 && hg branch && hg tip && curl -s 
http://bugs.python.org/file25192/aa2dcffa267f.diff | patch -p1
destination directory: cpython
requesting all changes
adding changesets
adding manifests
adding file changes
added 77379 changesets with 172430 changes to 9646 files (+1 heads)
updating to branch default
3917 files updated, 0 files merged, 0 files removed, 0 files unresolved
3574 files updated, 0 files merged, 945 files removed, 0 files unresolved
2.7
changeset:   77378:da5b370f41a1
branch:  2.7
tag: tip
user:Richard Oudkerk 
date:Wed Jun 06 19:01:14 2012 +0100
summary: Issue #13854: Properly handle non-integer, non-string arg to 
SystemExit

patching file .hgignore
patching file Doc/library/debug.rst
patching file Doc/library/dtrace.rst
patching file Include/code.h
patching file Include/pydtrace.d
patching file Include/pydtrace.h
patching file Include/pydtrace_offsets.c
patching file Include/pydtrace_offsets.sh
patching file Lib/test/dtrace_sample.py
patching file Lib/test/test_dtrace.py
patching file Makefile.pre.in
patching file Modules/dtracemodule.c
patching file Modules/gcmodule.c
Hunk #2 succeeded at 873 (offset 51 lines).
Hunk #3 succeeded at 1038 (offset 54 lines).
patching file Objects/classobject.c
Hunk #2 succeeded at 557 (offset 10 lines).
Hunk #3 succeeded at 622 (offset 10 lines).
Hunk #4 succeeded at 676 (offset 10 lines).
Hunk #5 succeeded at 758 (offset 10 lines).
patching file Objects/codeobject.c
patching file Objects/typeobject.c
Hunk #4 succeeded at 931 (offset 5 lines).
patching file Python/ceval.c
patching file Python/sysmodule.c
patching file configure
Hunk #1 succeeded at 619 (offset 8 lines).
Hunk #2 succeeded at 768 (offset 8 lines).
Hunk #3 succeeded at 1444 (offset 8 lines).
Hunk #4 FAILED at 2616.
Hunk #5 FAILED at 3548.
Hunk #6 FAILED at 3663.
Hunk #7 FAILED at 3706.
Hunk #8 FAILED at 3765.
Hunk #9 FAILED at 3817.
Hunk #10 FAILED at 4360.
Hunk #11 FAILED at 6713.
Hunk #12 FAILED at 6746.
Hunk #13 FAILED at 6779.
Hunk #14 FAILED at 6812.
Hunk #15 FAILED at 6845.
Hunk #16 FAILED at 6878.
Hunk #17 FAILED at 6911.
Hunk #18 FAILED at 6944.
Hunk #19 FAILED at 6977.
Hunk #20 FAILED at 7037.
Hunk #21 FAILED at 7098.
Hunk #22 FAILED at 7159.
Hunk #23 FAILED at 7207.
Hunk #24 FAILED at 7248.
Hunk #25 FAILED at 7310.
Hunk #26 FAILED at 7381.
Hunk #27 succeeded at 9464 (offset 8 lines).
Hunk #28 FAILED at 12456.
Hunk #29 FAILED at 12508.
Hunk #30 FAILED at 12627.
Hunk #31 FAILED at 12893.
Hunk #32 FAILED at 14693.
Hunk #33 FAILED at 15008.
Hunk #34 FAILED at 15036.
Hunk #35 FAILED at 15063.
31 out of 35 hunks FAILED -- saving rejects to file configure.rej
can't find file to patch at input line 2128
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--
|diff -r 70274d53c1dd -r aa2dcffa267f configure.in
|--- a/configure.in Mon Apr 09 19:04:04 2012 -0400
|+++ b/configure.in Thu Apr 12 12:51:51 2012 +0200
--
File to patch:

--

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



[issue13405] Add DTrace probes

2012-06-07 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

If I do `/configure --with-dtrace --enable-framework && make` then I get:

```
...
gcc -c -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes-I. -I./Include-DPy_BUILD_CORE -o Modules/gcmodule.o 
Modules/gcmodule.c
Modules/gcmodule.c:1088: error: conflicting types for ‘collect’
Modules/gcmodule.c:849: error: previous definition of ‘collect’ was here
Modules/gcmodule.c: In function ‘collect’:
Modules/gcmodule.c:1093: warning: implicit declaration of function ‘collect2’
make: *** [Modules/gcmodule.o] Error 1
```

--

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



[issue13405] Add DTrace probes

2012-06-07 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

I hacked around the previous error (duplicate definitions of `collect`) and 
then ran into:

gcc -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes-I. -I./Include-DPy_BUILD_CORE -o 
./Include/pydtrace_offsets \
./Include/pydtrace_offsets.c
./Include/pydtrace_offsets.c: In function ‘main’:
./Include/pydtrace_offsets.c:26: warning: format ‘%d’ expects type ‘int’, but 
argument 2 has type ‘long int’
./Include/pydtrace_offsets.c:29: warning: format ‘%d’ expects type ‘int’, but 
argument 2 has type ‘long unsigned int’
./Include/pydtrace_offsets.c:31: warning: implicit declaration of function 
‘offsetof’
./Include/pydtrace_offsets.c:31: error: expected expression before 
‘PyCompactUnicodeObject’
./Include/pydtrace_offsets.c:33: error: expected expression before 
‘PyCompactUnicodeObject’
make: *** [Include/pydtrace_offsets.h] Error 1

I was able to fix this by adding "#include ".

--

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



[issue15195] test_distutils fails when ARCHFLAGS is set on a Mac

2012-06-26 Thread Marc Abramowitz

New submission from Marc Abramowitz :

$ export ARCHFLAGS="-arch i386 -arch x86_64"
$ ./python.exe -m test -v test_distutils

[last: 0] marca@scml-marca:~/dev/hg-repos/cpython$ ./python.exe
Python 3.3.0a4+ (default:6af0535b5e3a, Jun 25 2012, 16:59:49) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
[59901 refs]
>>> sysconfig.get_config_var('LDSHARED')
'gcc -bundle -undefined dynamic_lookup'
[59906 refs]
>>> import distutils.sysconfig
[61596 refs]
>>> distutils.sysconfig.get_config_var('LDSHARED')
'gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64'
[77979 refs]

--
components: Tests
messages: 164081
nosy: Marc.Abramowitz
priority: normal
severity: normal
status: open
title: test_distutils fails when ARCHFLAGS is set on a Mac
versions: Python 3.3

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



[issue15195] test_distutils fails when ARCHFLAGS is set on a Mac

2012-06-26 Thread Marc Abramowitz

Changes by Marc Abramowitz :


--
type:  -> behavior

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



[issue15031] Split .pyc parsing from module loading

2012-06-26 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Another package that inspects pyc files and which also ran into trouble because 
of the 8 to 12 byte change is distribute.

See: 
https://bitbucket.org/tarek/distribute/issue/283/bdist_egg-issues-with-python-330ax

Some kind of abstraction for loading pyc files would be nice.

--
nosy: +Marc.Abramowitz

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-06-26 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Attaching a patch...

Using Ronan's test_PyPyc.diff, before my patch:

{{{
~/dev/hg-repos/cpython$ ./python.exe -m unittest 
Lib/importlib/test/source/test_abc_loader.py 
...E..
==
ERROR: test_pyc_compatibility 
(Lib.importlib.test.source.test_abc_loader.RegeneratedBytecodeTests)
--
Traceback (most recent call last):
  File "./Lib/importlib/test/source/util.py", line 23, in wrapper
to_return = fxn(*args, **kwargs)
  File "./Lib/importlib/test/source/test_abc_loader.py", line 473, in 
test_pyc_compatibility
mock.load_module(name)
  File "", line 760, in load_module
  File "", line 408, in module_for_loader_wrapper
  File "", line 636, in _load_module
  File "./Lib/importlib/test/source/test_abc_loader.py", line 201, in get_code
code_object = super().get_code(name)
  File "/Users/marca/dev/hg-repos/cpython/Lib/importlib/abc.py", line 305, in 
get_code
return marshal.loads(bytecode)
ValueError: bad marshal data (unknown type code)

--
Ran 62 tests in 0.076s

FAILED (errors=1)
[114118 refs]
}}}

After my patch:

{{{
~/dev/hg-repos/cpython$ patch -p1 < ~/Desktop/cpython-issue-15030.patch 
patching file Lib/importlib/abc.py
~/dev/hg-repos/cpython$ ./python.exe -m unittest 
Lib/importlib/test/source/test_abc_loader.py 
..
--
Ran 62 tests in 0.079s

OK
[114118 refs]
}}}

--
nosy: +Marc.Abramowitz
Added file: http://bugs.python.org/file26173/cpython-issue-15030.patch

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-06-26 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Similar issue in distribute: 
https://bitbucket.org/tarek/distribute/issue/283/bdist_egg-issues-with-python-330ax

--

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



[issue15031] Split .pyc parsing from module loading

2012-06-27 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Well, it may be a vestige from setuptools and I don't know if it's still 
needed/appropriate, but distribute scans the pyc modules to try to see whether 
stuff is zip_safe or not when you run `python setup.py bdist_egg`:

https://bitbucket.org/tarek/distribute/src/da2848d34282/setuptools/command/bdist_egg.py#cl-420

Personally, I always set zip_safe to True as I find zipped distributions to be 
a pain in the butt, but not all distributions out there always set it and 
currently `python setup.py bdist_egg` (and probably other commands?) bombs on 
such packages.

We should probably get Tarek to weigh in here.

--

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-06-27 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Updated patch based on feedback from Brett (thanks!)

--
Added file: http://bugs.python.org/file26177/cpython-issue-15030.patch

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-06-27 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Third revision of my patch based on additional feedback from Brett (thanks!)...

--
Added file: http://bugs.python.org/file26178/cpython-issue-15030.patch

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-06-27 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Brett, I just emailed the contributor agreement.

--

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-06-27 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Hmmm if I simply do:

diff -r b66e82c9f852 Lib/importlib/abc.py
--- a/Lib/importlib/abc.py  Tue Jun 26 23:05:27 2012 +0200
+++ b/Lib/importlib/abc.py  Wed Jun 27 12:15:55 2012 -0700
@@ -282,7 +282,7 @@
 if len(raw_timestamp) < 4:
 raise EOFError("bad timestamp in {}".format(fullname))
 pyc_timestamp = _bootstrap._r_long(raw_timestamp)
-bytecode = data[8:]
+bytecode = data[12:]
 # Verify that the magic number is valid.
 if imp.get_magic() != magic:
 raise ImportError(

then I get two "ValueError: bad marshal data (unknown type code)" test errors 
in test_abc_loader.

I am unsure as to whether this is a bug in the test or the implementation.

The following quells the errors, but I am not all confident that it's correct:

@@ -302,7 +302,10 @@
 raise
 else:
 # Bytecode seems fine, so try to use it.
-return marshal.loads(bytecode)
+try:
+return marshal.loads(bytecode)
+except ValueError:
+return ''
 elif source_timestamp is None:
 raise ImportError("no source or bytecode available to create code "
   "object for {0!r}".format(fullname),

--

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-06-27 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Here's a patch that unconditionally switches over to the 12 byte format. I'm 
assuming the "size" in data[8:12] is the length of the bytecode?

--
Added file: http://bugs.python.org/file26186/cpython-issue-15030.patch

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-06-27 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Oops, last attachment included the source timestamp twice instead of timestamp 
+ bytecode size.

--
Added file: http://bugs.python.org/file26188/cpython-issue-15030.patch

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-06-27 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Oops. Refactor. :-)

--
Added file: http://bugs.python.org/file26189/cpython-issue-15030.patch

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-06-28 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

I don't know if I'll have time soon to do the tweaks to Ronan's test (and maybe 
he wants to do them himself anyway?), but here's the correction of the size 
calculation in the header (from size of bytecode to size of source -- thanks, 
Brett!)

--
Added file: http://bugs.python.org/file26200/cpython-issue-15030.patch

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



[issue15225] Add negative tests for passing str to hmac.HMAC and hmac.new

2012-06-29 Thread Marc Abramowitz

New submission from Marc Abramowitz :

I had been thinking of improving the error message for this case slightly -- 
and then couldn't find a test for this case so I'm adding one in the attached 
patch...

--
components: Tests
files: test_hmac.py.patch
keywords: patch
messages: 164348
nosy: Marc.Abramowitz
priority: normal
severity: normal
status: open
title: Add negative tests for passing str to hmac.HMAC and hmac.new
versions: Python 3.3
Added file: http://bugs.python.org/file26212/test_hmac.py.patch

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



[issue15225] Add negative tests for passing str to hmac.HMAC and hmac.new

2012-06-29 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

And here is the tiny patch to make it clear in the error message which of the 3 
arguments had the wrong type -- I follow the convention followed in some 
TypeErrors raised in Lib/zipfile.py

--
Added file: http://bugs.python.org/file26213/hmac.py.patch

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



[issue15225] Add negative tests for passing str to hmac.HMAC and hmac.new

2012-06-30 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Updating patch

--
Added file: http://bugs.python.org/file26219/hmac.py.patch

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



[issue15225] Add negative tests for passing str to hmac.HMAC and hmac.new

2012-06-30 Thread Marc Abramowitz

Changes by Marc Abramowitz :


--
type:  -> enhancement
Added file: http://bugs.python.org/file26220/test_hmac.py.patch

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-07-02 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Hi Brett, can I get an ack in Misc/ACKS please (to make my Mom proud :-))? 
Attaching patch.

--
Added file: http://bugs.python.org/file26236/Misc_ACKS.patch

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



[issue15030] PyPycLoader can't read cached .pyc files

2012-07-02 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Hi Martin,

I already did. See http://bugs.python.org/msg164162 and 
http://bugs.python.org/msg164164. Maybe it's not "on file" yet?

--

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



[issue15256] Typo in error message

2012-07-05 Thread Marc Abramowitz

New submission from Marc Abramowitz :

>From a failing unit test with coverage.py, I noticed what seems to be a slight 
>typo in the error message when a module cannot be imported:

diff -r 1186d68715cc Lib/imp.py
--- a/Lib/imp.pyWed Jul 04 19:33:45 2012 -0700
+++ b/Lib/imp.pyThu Jul 05 11:50:25 2012 -0700
@@ -230,7 +230,7 @@
 continue
 break  # Break out of outer loop when breaking out of inner loop.
 else:
-raise ImportError('No module name {!r}'.format(name), name=name)
+raise ImportError('No module named {!r}'.format(name), name=name)
 
 encoding = None
 if mode == 'U':

Note the missing "d". This makes it match similar existing error messages:

Lib/importlib/_bootstrap.py
1238:_ERR_MSG = 'No module named {!r}'

Lib/modulefinder.py
185:self.msgout(4, "raise ImportError: No module named", qname)
186:raise ImportError("No module named " + qname)
198:self.msgout(4, "raise ImportError: No module named", mname)
199:raise ImportError("No module named " + mname)
215:raise ImportError("No module named " + subname)

Lib/runpy.py
106:raise ImportError("No module named %s" % mod_name)

I wonder if this can be centralized to ensure that all code uses the exact same 
message?

--
components: Library (Lib)
messages: 164693
nosy: Marc.Abramowitz, brett.cannon
priority: normal
severity: normal
status: open
title: Typo in error message
type: behavior
versions: Python 3.3

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



[issue15256] Typo in error message

2012-07-06 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

I think this is just a simple typo and a consistency issue; not a grammatical 
issue.

The misspelled version was added in a recent commit:

[last: 0] marca@SCML-MarcA:~/dev/hg-repos/cpython$ hg log -r 76455
changeset:   76455:085cf1480cfe
user:Brett Cannon 
date:Sat Apr 21 21:09:46 2012 -0400
summary: Issue #13959: Re-implement imp.find_module() in Lib/imp.py.

Link to issue: http://bugs.python.org/issue13959

--

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



[issue15256] Typo in error message

2012-07-06 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Attaching patch

--
keywords: +patch
Added file: http://bugs.python.org/file26271/python_issue_15256.patch

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



[issue15256] Typo in error message

2012-07-06 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Patch with Brett's comments

--
Added file: http://bugs.python.org/file26272/python_issue_15256.patch

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



[issue15195] test_distutils fails when ARCHFLAGS is set on a Mac

2012-07-23 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

I just verified -- the issue seems to be fixed for me on OS X 10.6.8 with 
revision 00db71b3c5bd. Thanks!

--

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-19 Thread Marc Abramowitz

Changes by Marc Abramowitz :


--
nosy: +Marc.Abramowitz

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-19 Thread Marc Abramowitz

Marc Abramowitz added the comment:

As it happens, I wrote a similar context manager to Victor's recently for a 
setup.py because I wanted to suppress compiler errors that are output to the 
console by distutils.ccompiler.CCompiler.has_function. As Victor mentioned, for 
this to work with subprocesses, you need to go a little more low-level and mess 
around with file descriptors. Here's my function:

http://marc-abramowitz.com/archives/2013/07/19/python-context-manager-for-redirected-stdout-and-stderr/

(Maybe distutils.ccompiler.CCompiler.has_function should redirect its own 
output automatically, but that's another issue)

But then I got to thinking that it could be made a bit more powerful and the 
syntax could be a little nicer. So I have this code that I'm experimenting with:

https://gist.github.com/msabramo/6043474

But critiquing my own function, I wonder if it's trying to do too much in one 
function and it's using keyword arguments where it could be using the with 
statement better. So I might like Nick's API better.

--

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Marc Abramowitz

Marc Abramowitz added the comment:

I agree also that io is a good place for the basic version that doesn't do file 
descriptor stuff and maybe the fancy file descriptor stuff should be a separate 
issue and should go in subprocess.

To move this along and generate more discussion, I took code from Nick earlier 
in the thread and made a little patch and a test program and put it in a gist:

https://gist.github.com/msabramo/6049140

If folks like that, I can convert the test program into an automated test. 

What do you guys think?

--

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Marc Abramowitz

Marc Abramowitz added the comment:

Oops, Nick => Brett.

--

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Marc Abramowitz

Marc Abramowitz added the comment:

Thanks Nick! I'll work on applying your suggestions a little later. And I'll 
add a note about it not working with subprocesses because I realized that I 
forgot to do that. 

Regarding redirect_stdfile, which is presumably what you meant by "name-based 
API", I started out with unqualified names like 'stdout', etc. I went with the 
qualified name as an attempt at making it more general (i.e.: if folks perhaps 
wanted to use this for something other than sys files) - I don't know whether 
or not this is useful - I don't have a use case in mind (anyone else got one?) 
- so I don't know if qualified names brings anything useful or not but that was 
the thinking. Thoughts on this are welcome.

--

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Marc Abramowitz

Marc Abramowitz added the comment:

I like Nick's version. I don't know if __exit__ really needs error checking, 
but I like the API. For me, it strikes a good balance between being intuitive 
and being general enough to do all the stuff I'd like to do. 

Should the docstrings mention that it only works within the process and doesn't 
affect subprocesses?

I also am having second thoughts about putting it in the io module. Now I'm 
thinking that sys makes more sense because that's where stdin, stdout, and 
stderr live.

--

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