[issue26710] ConfigParser: Values in DEFAULT section override defaults passed to constructor

2016-05-02 Thread Marc Abramowitz

Marc Abramowitz added the comment:

Well my thought is that the configuration file has defaults that a user may 
want to override at runtime using an environment variable or command-line 
switch.

I guess as SilentGhost pointed out, maybe this is not the responsibility of the 
ConfigParser as this behavior is not related to config files per se, though 
it's curious that the ConfigParser allows the user to pass in values in the 
constructor.

Since two people are -1 on this, it seems pretty clear that I am on the wrong 
track with this, so I think we can close this.

--
resolution:  -> rejected
status: open -> closed

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



[issue26710] ConfigParser: Values in DEFAULT section override defaults passed to constructor

2016-04-07 Thread Marc Abramowitz

Marc Abramowitz added the comment:

So I think changing the behavior of `defaults` might break backwards 
compatibility for folks who are relying on the old behavior.

So I guess I would propose adding a new parameter called `overrides`. These 
would take precedence over `defaults` and that allows retaining backwards 
compatibility.

--

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



[issue26710] ConfigParser: Values in DEFAULT section override defaults passed to constructor

2016-04-07 Thread Marc Abramowitz

Marc Abramowitz added the comment:

Some more info on the logging example I gave.

So here is a program called `my_app.py`:

```
import os
import logging.config

logging.config.fileConfig('logging.ini', defaults=os.environ)
logger = logging.getLogger(__name__)
logger.debug('debug msg')
logger.info('info msg')
logger.warn('warn msg')
logger.error('error msg')
root_logger = logging.getLogger()
print('root_logger.level = %d; logging.WARN = %d; logging.DEBUG = %d'
  % (root_logger.level, logging.WARN, logging.DEBUG))
```

Note that it calls logging.config.fileConfig with defaults=os.environ so that 
environment variables can be used to affect the logging configuration.


And here is `logging.ini`:

```
###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/logging.html
###

[loggers]
keys = root, fakeproject, sqlalchemy

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = %(logging_logger_root_level)s
handlers = console

[logger_fakeproject]
level = DEBUG
handlers =
qualname = fakeproject

[logger_sqlalchemy]
level = INFO
handlers =
qualname = sqlalchemy.engine
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARN" logs neither.  (Recommended for production systems.)

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] 
%(message)s
```

Note that in the `logger_root` section of `logging.ini`, the variable 
`logging_logger_root_level` is referenced but not defined. For now, we are 
going to rely on getting that from an environment variable.


If I provide an environment variable when running the program:

```
$ LOGGING_LOGGER_ROOT_LEVEL=DEBUG python my_app.py
2016-04-07 08:26:36,184 DEBUG [__main__:6][MainThread] debug msg
2016-04-07 08:26:36,184 INFO  [__main__:7][MainThread] info msg
2016-04-07 08:26:36,184 WARNI [__main__:8][MainThread] warn msg
2016-04-07 08:26:36,184 ERROR [__main__:9][MainThread] error msg
root_logger.level = 10; logging.WARN = 30; logging.DEBUG = 10
```

then it works and the root logger level is DEBUG as expected. Great!

But what happens if the user leaves out the environment variable?

```
$ python my_app.py
Traceback (most recent call last):
  File "my_app.py", line 4, in 
logging.config.fileConfig('logging.ini', defaults=os.environ)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py",
 line 86, in fileConfig
_install_loggers(cp, handlers, disable_existing_loggers)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py",
 line 196, in _install_loggers
level = cp.get(sectname, "level")
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py",
 line 623, in get
return self._interpolate(section, option, value, d)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py",
 line 669, in _interpolate
option, section, rawval, e.args[0])
ConfigParser.InterpolationMissingOptionError: Bad value substitution:
section: [logger_root]
option : level
key: logging_logger_root_level
rawval : %(logging_logger_root_level)s
```

An error occurs as expected. 

But I'd like to be able to provide a default value so that user doesn't have to 
set the environment variable, so let's add this to the top of `logging.ini`:

```
[DEFAULT]
logging_logger_root_level = WARN
```

Now let's run the program again without the environment variable to see if that 
fixed the problem:

```
$ python my_app.py
2016-04-07 08:33:07,101 WARNI [__main__:8][MainThread] warn msg
2016-04-07 08:33:07,101 ERROR [__main__:9][MainThread] error msg
root_logger.level = 30; logging.WARN = 30; logging.DEBUG = 10
```

Awesome! It worked and set the root logger level to the default of WARN, as 
expected.

Now what happens if we try to override the default with an environment variable?

```
$ LOGGING_LOGGER_ROOT_LEVEL=DEBUG python my_app.py
2016-04-07 08:33:56,047 WARNI [__main__:8][MainThread] warn msg
2016-04-07 08:33:56,048 ERROR [__main__:9][MainThread] error msg
root_logger.level = 30; logging.WARN = 30; logging.DEBUG = 10
```

Doh! The root logger level is still WARN. So the default in the ini file took 
precedence over what the user provided. This is unfortunate.

So how does one provide defaults while also allowing overriding those defaults?

--

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



[issue26710] ConfigParser: Values in DEFAULT section override defaults passed to constructor

2016-04-07 Thread Marc Abramowitz

New submission from Marc Abramowitz:

My expectation was that any defaults I passed to ConfigParser when creating one 
would override values in the DEFAULT section of the config file. This is 
because I'd like the DEFAULT section to have the default values, but then I 
want to be able to override those with settings from environment variables.

However, this is not the way it works. The defaults in the file take precedence 
over the defaults passed to the constructor. I didn't see a mention of this in 
the docs, but I might've missed it.

Take this short program (`configparsertest.py`):

```
import configparser

cp = configparser.ConfigParser({'foo': 'dog'})
print(cp.defaults())
cp.read('app.ini')
print(cp.defaults())
```

and this config file (`app.ini`):

```
[DEFAULT]
foo = bar
```

I was expecting that I would see foo equal to dog twice, but what I get is:

```
$ python configparsertest.py
OrderedDict([('foo', 'dog')])
OrderedDict([('foo', 'bar')])
```

The reason that I want the programmatic default values to override the default 
values in the file is that I want the file to have low-precedence defaults that 
are used as a last resort, and I want to be able to override the defaults with 
the values from environment variables.

As a concrete example, imagine that I have a config file for the stdlib 
`logging` module that looks something like this:

```
[DEFAULT]
logging_logger_root_level = WARN
...
[logger_root]
level = %(logging_logger_root_level)s
handlers = console
```

The desired behavior is that normally the app would use the WARN level for 
logging, but I'd like to be able to do something like:

```
$ LOGGING_LOGGER_ROOT_LEVEL=DEBUG python my_app.py
```

to get DEBUG logging.

Maybe there is some other mechanism to accomplish this?

--
components: Library (Lib)
messages: 262989
nosy: Marc.Abramowitz
priority: normal
severity: normal
status: open
title: ConfigParser: Values in DEFAULT section override defaults passed to 
constructor
type: behavior

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



[issue23239] SSL match_hostname does not accept IP Address

2016-04-07 Thread Marc Abramowitz

Marc Abramowitz added the comment:

`ip_certs_comment.patch` is a simple patch that just removes the verbiage about 
not supporting IP addresses in hostnames, as that restriction was removed by an 
earlier commit from Antoine.

--

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



[issue23239] SSL match_hostname does not accept IP Address

2016-03-19 Thread Marc Abramowitz

Marc Abramowitz added the comment:

Patch to update the comment to remove "IP addresses are not accepted for 
*hostname*", because supported for IP addresses was added earlier by @pitrou in 
https://hg.python.org/cpython/rev/b15a5f239e8a

--
nosy: +Marc.Abramowitz
Added file: http://bugs.python.org/file42186/ip_certs_comment.patch

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



[issue6958] Add Python command line flags to configure logging

2016-03-05 Thread Marc Abramowitz

Marc Abramowitz added the comment:

I guess I should be more specific about the 12factor thing I just mentioned, 
because http://12factor.net/logs says:

>>>
A twelve-factor app never concerns itself with routing or storage of its output 
stream. It should not attempt to write to or manage logfiles. Instead, each 
running process writes its event stream, unbuffered, to stdout. During local 
development, the developer will view this stream in the foreground of their 
terminal to observe the app’s behavior.
>>>

The part that I want to be configurable is what the log levels are for various 
loggers.

For example, in production, you probably want most or all of your loggers set 
to WARN or such.

When running in development, ideally the developer can turn on more verbose 
logging without having to edit config files.

e.g.:

This is a Pyramid application, but environment variables of course could be 
used with any kind of application -- Django, etc.

```
LOGGER_ANWEB_LEVEL=debug pserve app.ini
```

--

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



[issue6958] Add Python command line flags to configure logging

2016-03-05 Thread Marc Abramowitz

Marc Abramowitz added the comment:

I was just thinking that it would be nice if logging could be configured 
through environment variables. This would make it easier to have Python 
applications adhere to the Twelve-Factor methodology around application 
configuration:

http://12factor.net/config

Currently, applications need to handle this themselves, but I wonder if there's 
value in deciding on a best practice and providing for it at a lower level (the 
stdlib logging module).

--
nosy: +Marc.Abramowitz

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



[issue23063] `python setup.py check --restructuredtext --strict --metadata` fails with: `warning: check: Could not finish the parsing.` if the RST document uses code or code-block directives.

2014-12-16 Thread Marc Abramowitz

Marc Abramowitz added the comment:

Testing a few common cases:

$ python setup.py check --restructuredtext --strict --metadata
running check
error: The docutils package is needed.

$ python setup.py check --restructuredtext --strict --metadata
running check
warning: check: Cannot analyze code. Pygments package not found. (line 66)

warning: check: Cannot analyze code. Pygments package not found. (line 99)

error: Please correct your package.

$ python setup.py check --restructuredtext --strict --metadata  echo RST was 
OK.
running check
RST was OK.

--

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



[issue23063] `python setup.py check --restructuredtext --strict --metadata` fails with: `warning: check: Could not finish the parsing.` if the RST document uses code or code-block directives.

2014-12-16 Thread Marc Abramowitz

Marc Abramowitz added the comment:

Note that this patch does 2 things:

1. Improves the error message
2. Prevents check from failing when there are code-blocks

If I only did #1 and not #2, then output looks like this:

$ python setup.py check --restructuredtext --strict --metadata  echo RST was 
OK.
running check
warning: check: Could not finish the parsing: 'Values' object has no attribute 
'syntax_highlight'.

error: Please correct your package.

--

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



[issue23063] `python setup.py check --restructuredtext --strict --metadata` fails with: `warning: check: Could not finish the parsing.` if the RST document uses code or code-block directives.

2014-12-16 Thread Marc Abramowitz

Marc Abramowitz added the comment:

OK, I added a test.

See:

* 
https://bitbucket.org/msabramo/cpython/commits/9b8f6812ff6981b5f195b6bf73cefb0fea46fba6
* 
https://bitbucket.org/msabramo/cpython/pull-request/1/fix-distutils-setuppy-check/diff

If you want, I can also update the diff attached here, but maybe it's easier to 
just look at my branch on Bitbucket? Whatever is most convenient for you...

--

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



[issue23063] `python setup.py check --restructuredtext --strict --metadata` fails with: `warning: check: Could not finish the parsing.` if the RST document uses code or code-block directives.

2014-12-16 Thread Marc Abramowitz

Changes by Marc Abramowitz msabr...@gmail.com:


Added file: http://bugs.python.org/file37472/issue23063.patch

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



[issue23063] `python setup.py check --restructuredtext --strict --metadata` fails with: `warning: check: Could not finish the parsing.` if the RST document uses code or code-block directives.

2014-12-16 Thread Marc Abramowitz

Marc Abramowitz added the comment:

What's the next step?

--

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



[issue23063] `python setup.py check --restructuredtext --strict --metadata` fails with: `warning: check: Could not finish the parsing.` if the RST document uses code or code-block directives.

2014-12-15 Thread Marc Abramowitz

New submission from Marc Abramowitz:

`python setup.py check --restructuredtext --strict --metadata` fails with:

warning: check: Could not finish the parsing.

if the RST document uses `code` or `code-block` directives.

This is annoying because the document is valid, but it appears to be invalid
and confuses people. For example, see
https://github.com/ionelmc/pytest-benchmark/pull/4#issuecomment-66940307

How to reproduce this bug
-

Clone a repo that has a `README.rst` with `code-block` directives in it. E.g.:

$ git clone g...@github.com:ionelmc/pytest-benchmark.git
$ cd pytest-benchmark
$ git checkout ab0b08f6fccb06a7909905a8409f8faa8b01e0d8

   Observe that it has code-blocks in it:

   $ grep 'code-block' README.rst
   .. code-block:: python
   .. code-block:: python

Observe that RST document is valid, according to `rst2html.py`:

   $ rst2html.py --halt=1 README.rst  README.html  echo RST was OK.
   RST was OK.

   $ head -n 3 README.html
   ?xml version=1.0 encoding=utf-8 ?
   !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
   html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en

Observe that `python setup.py check --restructuredtext --strict --metadata` 
fails:

$ python setup.py check --restructuredtext --strict --metadata
running check
warning: check: Could not finish the parsing.

error: Please correct your package.

$ echo $?
1

**What was expected**: `python setup.py check --restructuredtext --strict
--metadata` should succeed with no warnings, just as `rst2html.py did`, because
`README.rst` is a valid RST document.

**What actually happened**: `python setup.py check --restructuredtext --strict
--metadata` prints a warning and an error and fails, unlike `rst2html.py`

The error is coming from here:
https://github.com/python/cpython/blob/master/Lib/distutils/command/check.py#L142

It's happening because of this line:
https://github.com/python/cpython/blob/master/Lib/distutils/command/check.py#L125

:::python
settings = frontend.OptionParser().get_default_values()

If this is changed to:

:::python
settings = frontend.OptionParser(components=(Parser,)).get_default_values()

then things work much better (this is how `tools/quicktest.py` in docutils does 
it for example -- see 
https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/tools/quicktest.py#l196)

The attached patch prevents the failure from happening and also adds more 
information to the error when things go south.

--
components: Distutils
hgrepos: 286
messages: 232720
nosy: Marc.Abramowitz, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: `python setup.py check --restructuredtext --strict --metadata` fails 
with: `warning: check: Could not finish the parsing.` if the RST document uses 
code or code-block directives.
type: behavior
versions: Python 2.7, 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/issue23063
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19555] SO config var not getting set

2013-11-11 Thread Marc Abramowitz

New submission from Marc Abramowitz:

I just installed Python 3.0a4 from source on an Ubuntu system and noticed that 
it doesn't seem to set the distutils.sysconfig config var: SO:

```
vagrant@ubuntu:~/src/Python-3.4.0a4$ python3.4
Python 3.4.0a4 (default, Nov 11 2013, 17:11:59)
[GCC 4.6.3] on linux
Type help, copyright, credits or license for more information.
 from distutils import sysconfig
 sysconfig.get_config_var(SO)
 sysconfig.get_config_var(SO) is None
True
```

This worked fine for me in Python 3.3:

```
vagrant@ubuntu:~/src/Python-3.4.0a4$ python3.3
Python 3.3.2 (default, May 16 2013, 18:32:41)
[GCC 4.6.3] on linux
Type help, copyright, credits or license for more information.
 from distutils import sysconfig
 sysconfig.get_config_var(SO)
'.so'
```

--
assignee: eric.araujo
components: Distutils
messages: 202634
nosy: Marc.Abramowitz, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: SO config var not getting set
type: behavior
versions: Python 3.4

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



[issue19555] SO config var not getting set

2013-11-11 Thread Marc Abramowitz

Marc Abramowitz added the comment:

Thanks Barry, for tracking down that this is intentional.

I wonder how one gets this value in Python code now? For example, the reason I 
stumbled upon this in the first place is that there is some code in PyCrypto 
(https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/SelfTest/PublicKey/test_RSA.py#L464)
 that uses `get_config_var(SO)` thusly:

```
except ImportError:
from distutils.sysconfig import get_config_var
import inspect
_fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe(
+/../../PublicKey/_fastmath+get_config_var(SO))
if os.path.exists(_fm_path):
raise ImportError(While the _fastmath module exists, importing +
it failed. This may point to the gmp or mpir shared library +
not being in the path. _fastmath was found at +_fm_path)
```

What would be the way to express this now in Python = 3.4?

--

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



[issue13405] Add DTrace probes

2013-10-08 Thread Marc Abramowitz

Marc Abramowitz added the comment:

Nice to see this moving along as I helped Jesús a while back with some testing 
on OS X and FreeBSD. The buildbots in particular sound like a great asset.

Let me know if I can help again with testing, though it looks like the basics 
are pretty well-covered by the buildbots.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13405
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://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 rep...@bugs.python.org
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 rep...@bugs.python.org
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 rep...@bugs.python.org
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 rep...@bugs.python.org
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

Changes by Marc Abramowitz msabr...@gmail.com:


--
nosy: +Marc.Abramowitz

___
Python tracker rep...@bugs.python.org
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 rep...@bugs.python.org
http://bugs.python.org/issue15805
___
___
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 msabr...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue15195
___
___
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 msabr...@gmail.com 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 br...@python.org
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 rep...@bugs.python.org
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 msabr...@gmail.com added the comment:

Attaching patch

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

___
Python tracker rep...@bugs.python.org
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 msabr...@gmail.com added the comment:

Patch with Brett's comments

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

___
Python tracker rep...@bugs.python.org
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-05 Thread Marc Abramowitz

New submission from Marc Abramowitz msabr...@gmail.com:

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 rep...@bugs.python.org
http://bugs.python.org/issue15256
___
___
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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-30 Thread Marc Abramowitz

Marc Abramowitz msabr...@gmail.com added the comment:

Updating patch

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

___
Python tracker rep...@bugs.python.org
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 msabr...@gmail.com:


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

___
Python tracker rep...@bugs.python.org
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

New submission from Marc Abramowitz msabr...@gmail.com:

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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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-06-28 Thread Marc Abramowitz

Marc Abramowitz msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com added the comment:

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

--

___
Python tracker rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com added the comment:

Updated patch based on feedback from Brett (thanks!)

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

___
Python tracker rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com added the comment:

Brett, I just emailed the contributor agreement.

--

___
Python tracker rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com added the comment:

Oops. Refactor. :-)

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

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15030
___
___
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 msabr...@gmail.com:

$ 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 rep...@bugs.python.org
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 msabr...@gmail.com:


--
type:  - behavior

___
Python tracker rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 frozen importlib._bootstrap, line 760, in load_module
  File frozen importlib._bootstrap, line 408, in module_for_loader_wrapper
  File frozen importlib._bootstrap, 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 rep...@bugs.python.org
http://bugs.python.org/issue15030
___
___
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 msabr...@gmail.com 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 shibt...@gmail.com
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 rep...@bugs.python.org
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 msabr...@gmail.com 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 shibt...@gmail.com
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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 stddef.h.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13405
___
___
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-02 Thread Marc Abramowitz

Marc Abramowitz msabr...@gmail.com 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
module 'pip.vcs.git' from './pip/vcs/git.py'
 import pip.vcs.mercurial
 pip.vcs.mercurial
module 'pip.vcs.mercurial' from './pip/vcs/mercurial.py'
 print(list(iter_modules(path=vcs.__path__, prefix=vcs.__name__+'.')))
[]
 print(list(iter_modules(path=vcs.__path__)))
[]

--

___
Python tracker rep...@bugs.python.org
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

New submission from Marc Abramowitz msabr...@gmail.com:

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'))
[(pkgutil.ImpImporter object at 0x1005bc710, 'lexicon', True), 
(pkgutil.ImpImporter object at 0x100649410, 'lexicon.alias_dict', False), 
(pkgutil.ImpImporter object at 0x100649410, 'lexicon.attribute_dict', False), 
(pkgutil.ImpImporter object at 0x1005bc710, 'reg_settings', False), 
(pkgutil.ImpImporter object at 0x1005bc710, '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 rep...@bugs.python.org
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 msabr...@gmail.com added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14982
___
___
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 msabr...@gmail.com added the comment:

Ned, thanks for applying this patch!

--

___
Python tracker rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com:

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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com:

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 rep...@bugs.python.org
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 msabr...@gmail.com added the comment:

Revising per feedback from Taggnostr on IRC.

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

___
Python tracker rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com:

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 rep...@bugs.python.org
http://bugs.python.org/issue14861
___
___
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com added the comment:

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

--

___
Python tracker rep...@bugs.python.org
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

2012-04-23 Thread Marc Abramowitz

Marc Abramowitz msabr...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue14572
___
___
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 msabr...@gmail.com added the comment:

Hey Jesús,

Let me know if you need any additional help testing.

Marc

--

___
Python tracker rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com added the comment:

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

--

___
Python tracker rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 rep...@bugs.python.org
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 msabr...@gmail.com 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 module 
(/Users/marca/python/test.py:1)
  2 125639 PyEval_EvalFrameExReal:function-entry module 
(/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/marca/python/test.py:4)
  2 125639 PyEval_EvalFrameExReal:function-entry add 
(/Users/marca/python/marcsmath.py:1)
  2 125639 PyEval_EvalFrameExReal:function-entry _remove 
(/Users/marca

[issue13405] Add DTrace probes

2012-02-21 Thread Marc Abramowitz

Marc Abramowitz msabr...@gmail.com 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 
stddef.h` 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 rep...@bugs.python.org
http://bugs.python.org/issue13405
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com