[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-08 Thread Sanyam Khurana

Sanyam Khurana  added the comment:

Thanks a lot Antoine and Nick :)

--

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-08 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

This is done.  Thank you Sanyam!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-08 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 7973e279a21999f134aff92dd6d344ec4591fae9 by Antoine Pitrou 
(Sanyam Khurana) in branch 'master':
bpo-21862: Add -m option to cProfile for profiling modules (#4297)
https://github.com/python/cpython/commit/7973e279a21999f134aff92dd6d344ec4591fae9


--

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-07 Thread Nick Coghlan

Nick Coghlan  added the comment:

Also, based on reviewing this, I suspect the same approach would also work for 
the pure Python profile module.

--

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-07 Thread Nick Coghlan

Nick Coghlan  added the comment:

I added an inline comment on the PR - I think what's there now would work fine, 
but I also suggested a slightly shorter and clearer (at least to me) 
alternative.

--

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le 07/11/2017 à 08:48, Nick Coghlan a écrit :
> 
> So from a runpy perspective, this approach gets a +1 from me, but I'd prefer 
> if there was someone more familiar with the cProfile module that was willing 
> to handle the merge.

Thanks Nick.  Can you confirm the runpy invocation in the PR is sane?

--

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-06 Thread Nick Coghlan

Nick Coghlan  added the comment:

Interesting - I'd never looked at how cProfile works before, and the fact it 
already doesn't support the "-i" (interactive) switch makes it much simpler to 
handle than the pdb case.

So from a runpy perspective, this approach gets a +1 from me, but I'd prefer if 
there was someone more familiar with the cProfile module that was willing to 
handle the merge.

--

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-06 Thread Sanyam Khurana

Change by Sanyam Khurana :


--
pull_requests: +4259

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-06 Thread Sanyam Khurana

Sanyam Khurana  added the comment:

Thanks for the heads up! I'll do that ;)

--

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Sanyam, you definitely can.  Step #1 would probably be to port the patch to git 
master and turn it into a GitHub PR.

--

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-06 Thread Sanyam Khurana

Sanyam Khurana  added the comment:

Hey, seems like this bug is not updated for a while. Can I work on this?

--
nosy: +CuriousLearner

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-06 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
versions: +Python 3.7 -Python 3.5

___
Python tracker 

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2015-03-16 Thread Mayank Tripathi

Mayank Tripathi added the comment:

Could someone please review the patch. Thanks.

--

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2015-01-27 Thread Mayank Tripathi

Mayank Tripathi added the comment:

Updated the patch and added docs and tests.

--
Added file: http://bugs.python.org/file37885/cProfile_module_option_2.patch

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2015-01-24 Thread Nick Coghlan

Nick Coghlan added the comment:

I haven't looked into the details of how cProfile handles command line 
arguments, but potentially relevant is issue #19982, which proposes adding a 
target parameter that lets runpy run in the context of an existing module 
object, rather than always creating its own.

However, if this can be implemented without that, go ahead - it can always be 
refactored later.

--

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2015-01-23 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

This change will cause the module to be imported twice:
progname = runpy.run_module(args[0])['__file__']
... and then the runctx() call.

What about something like:
code = runpy.run_module(modname, run_name='__main__')
globs = { 'runpy': runpy, 'modname': args[0] }

--

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2015-01-22 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag
stage: needs patch - patch review

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2015-01-17 Thread Mayank Tripathi

Mayank Tripathi added the comment:

Now allows parameters after the -m option.

--
nosy: +oquanox
Added file: http://bugs.python.org/file37749/cProfile_module_option.patch

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2014-12-19 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

The patch does not seem to allow parameters after the -m option.
I'm sure this restriction can be lifted.

--
nosy: +amaury.forgeotdarc

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2014-07-25 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

I added runpy import mechanism

--
nosy: +gennad
Added file: http://bugs.python.org/file36094/21862.patch

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2014-06-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

That's not how -m should work. It should use the runpy facilities (see the 
runpy module). Otherwise it probably won't work properly with qualified module 
names (-m pkg.subpkg.mod).

--

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2014-06-24 Thread Antoine Pitrou

New submission from Antoine Pitrou:

As the title says. You should be able to type:

$ python -m cProfile -m my.module.name

to profile execution of my.module.name.

--
components: Library (Lib)
keywords: easy
messages: 221488
nosy: georg.brandl, ncoghlan, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: cProfile command-line should accept -m module_name as an alternative 
to script path
type: enhancement
versions: Python 3.5

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2014-06-24 Thread Rock Lee

Rock Lee added the comment:

I tweaked the Lib/cProfile.py a little bit to get the feature done, please 
review the patch attached.

--
keywords: +patch
nosy: +rock
Added file: 
http://bugs.python.org/file35775/cProfile-add-new-option-module.patch

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