Re: How do I check if a string is a prefix of any possible other string that matches a given regex.

2014-10-08 Thread jonathan . slenders
Le mercredi 8 octobre 2014 01:40:11 UTC+2, MRAB a écrit : If you're not interested in generating an actual regex, but only in matching the prefix, then it sounds like you want partial matching. The regex module supports that: https://pypi.python.org/pypi/regex Wow, thanks a lot

Re: How do I check if a string is a prefix of any possible other string that matches a given regex.

2014-10-08 Thread Gregory Ewing
jonathan.slend...@gmail.com wrote: For each non-accepting state, determine whether it has any transitions that lead in one or more steps to an accepting state. Modify the FSM so that each such state is also an accepting state. Thanks, I'll make every state of the FSM an accepting state.

How do I check if a string is a prefix of any possible other string that matches a given regex.

2014-10-07 Thread jonathan . slenders
Hi everyone, Probably I'm turning the use of regular expressions upside down with this question. I don't want to write a regex that matches prefixes of other strings, I know how to do that. I want to generate a regex -- given another regex --, that matches all possible strings

Re: How do I check if a string is a prefix of any possible other string that matches a given regex.

2014-10-07 Thread Joshua Landau
On 7 October 2014 17:15, jonathan.slend...@gmail.com wrote: Probably I'm turning the use of regular expressions upside down with this question. I don't want to write a regex that matches prefixes of other strings, I know how to do that. I want to generate a regex -- given another regex

Re: How do I check if a string is a prefix of any possible other string that matches a given regex.

2014-10-07 Thread Ian Kelly
On Tue, Oct 7, 2014 at 10:15 AM, jonathan.slend...@gmail.com wrote: Logically, I'd think it should be possible by running the input string against the state machine that the given regex describes, and if at some point all the input characters are consumed, it's a match. (We don't have

Re: How do I check if a string is a prefix of any possible other string that matches a given regex.

2014-10-07 Thread jonathan . slenders
Logically, I'd think it should be possible by running the input string against the state machine that the given regex describes, and if at some point all the input characters are consumed, it's a match. (We don't have to run the regex until the end.) But I cannot find any library

Re: How do I check if a string is a prefix of any possible other string that matches a given regex.

2014-10-07 Thread MRAB
On 2014-10-07 22:48, jonathan.slend...@gmail.com wrote: Logically, I'd think it should be possible by running the input string against the state machine that the given regex describes, and if at some point all the input characters are consumed, it's a match. (We don't have to run the regex

help with regex

2014-10-07 Thread James Smith
I want the last 1 I can't this to work: pattern=re.compile( (\d+)$ ) match=pattern.match( LINE: 235 : Primary Shelf Number (attempt 1): 1) print match.group() -- https://mail.python.org/mailman/listinfo/python-list

[issue22364] Improve some re error messages using regex for hints

2014-10-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: As for #14, either UNICODE and LOCALE *are* compatible (for re) or this is buggy. This is buggy (issue22407). -- title: Unify error messages of re and regex - Improve some re error messages using regex for hints

[issue22364] Unify error messages of re and regex

2014-09-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The regex module is potential candidate for replacement of the re module. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22364

[issue22364] Unify error messages of re and regex

2014-09-19 Thread Mark Lawrence
Mark Lawrence added the comment: The key word is potential. I do not believe that any changes should be made to the re module until such time as there is a fully approved PEP for the regex module and that work has actually started on getting it into the stdlib. Surely backward compatibility

[issue22364] Improve some re error messages using regex for hints

2014-09-19 Thread Terry J. Reedy
of our re tests would need to be changed.) Re and regex are a bit special in that regex is the only re replacement (that I know of) and is (almost) a drop-in replacement. So some people *are*, on their own, replacing re with regex by installing regex (easy with pip) and adding 'import regex as re

[issue22364] Unify error messages of re and regex

2014-09-19 Thread Steven D'Aprano
the re error messages using regex as inspiration. -- title: Improve some re error messages using regex for hints - Unify error messages of re and regex ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22364

[issue22364] Unify error messages of re and regex

2014-09-18 Thread Mark Lawrence
Mark Lawrence added the comment: How can anything that's in the stdlib be unified with something that's not in the stdlib and currently has no prospects of getting in the stdlib? -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org

[issue22364] Unify error messages of re and regex

2014-09-12 Thread Terry J. Reedy
Terry J. Reedy added the comment: I prefer cannot for error messages. Can't is an informal version of cannot, used in speech, dialog representing speech, and 'informal' writing. It looks wrong to me in this context. -- nosy: +terry.reedy ___

[issue22364] Unify error messages of re and regex

2014-09-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: By the way, which is preferred, cannot or can't? The regex module always uses can't, but re module uses cannot except for TypeError: can't use a bytes pattern on a string-like object, I think. It's interesting question. Grepping in CPython sources got

[issue22364] Unify error messages of re and regex

2014-09-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, the idea of this issue is to enhance the re module (and the regex module if Matthew will) be picking the best error messages (or writing a new one). -- assignee: - serhiy.storchaka ___ Python tracker rep

[issue22364] Unify error messages of re and regex

2014-09-09 Thread Matthew Barnett
Matthew Barnett added the comment: re:Cannot process flags argument with a compiled pattern regex: can't process flags argument with a compiled pattern Error messages usually start with a lowercase letter, and I think that all the other ones in the re module do. By the way, which

[issue22364] Unify error messages of re and regex

2014-09-08 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: In some cases standard re module and third-party regex modules raise exceptions with different error messages. 1. re.match(re.compile('.'), 'A', re.I) re:Cannot process flags argument with a compiled pattern regex: can't process flags argument

[issue22364] Unify error messages of re and regex

2014-09-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: 18. re.compile(r'.???') re:multiple repeat regex: nothing to repeat at position 3 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22364

[issue22364] Unify error messages of re and regex

2014-09-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm dubious about this issue. It suggests that the wording of the exceptions is part of the API of the two modules. If the idea is just to copy the best error messages from one module to the other, then I guess there is no harm. But if the idea is to

Draft PEP - get the regex module into stdlib

2014-08-28 Thread Mark Lawrence
Here it is in full, comments welcome. Please refer to http://bugs.python.org/issue2636 That's all folks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list

Re: Draft PEP - get the regex module into stdlib

2014-08-28 Thread Chris Angelico
a smidge more coherent than that :) My apologies, but I don't have time to read 300 comments saying This! Is! Regex!. :):) ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Draft PEP - get the regex module into stdlib

2014-08-28 Thread Skip Montanaro
On Thu, Aug 28, 2014 at 6:10 PM, Chris Angelico ros...@gmail.com wrote: Ow, that doesn't look like a draft PEP to me, that looks like a 321-comment tracker issue. A PEP is usually a smidge more coherent than that :) From: http://legacy.python.org/dev/peps/pep-0001/ *PEP stands for Python

Re: Draft PEP - get the regex module into stdlib

2014-08-28 Thread Steven D'Aprano
Mark Lawrence wrote: Here it is in full, comments welcome. I think you forgot to attach the document. Or your mail/news server deleted it. If you attach it as a .txt file (preferably in ReST format) even the most obnoxiously strict news server ought to accept it. Please refer to

Re: string encoding regex problem

2014-08-23 Thread Philipp Kraus
Hi, On 2014-08-16 09:01:57 +, Peter Otten said: Philipp Kraus wrote: The code works till last week correctly, I don't change the pattern. Websites' contents and structure change sometimes. My question is, can it be a problem with string encoding? Your regex is all-ascii. So

Re: string encoding regex problem

2014-08-23 Thread Peter Otten
the pattern at the start of the string, returning a match object, or None if no match was found. As the string doesn't start with your regex re.match() is clearly wrong, but re.search() works for me: import re, urllib2 def URLReader(url) : ... f = urllib2.urlopen(url) ... data

Re: string encoding regex problem

2014-08-16 Thread Peter Otten
Philipp Kraus wrote: The code works till last week correctly, I don't change the pattern. Websites' contents and structure change sometimes. My question is, can it be a problem with string encoding? Your regex is all-ascii. So an encoding problem is very unlikely. found = re.search

string encoding regex problem

2014-08-15 Thread Philipp Kraus
Hello, I have defined a function with: def URLReader(url) : try : f = urllib2.urlopen(url) data = f.read() f.close() except Exception, e : raise MyError.StopError(e) return data which get the HTML source code from an URL. I use this to get a part of a HTML

Re: string encoding regex problem

2014-08-15 Thread Roy Smith
In article lsm8ic$j90$1...@online.de, Philipp Kraus philipp.kr...@flashpixx.de wrote: found = re.search( a href=\/projects/boost/files/latest/download\?source=files\ title=\/boost/(.*), Utilities.URLReader(http://sourceforge.net/projects/boost/files/boost/;) ) if found == None :

Re: string encoding regex problem

2014-08-15 Thread Philipp Kraus
On 2014-08-16 00:48:46 +, Roy Smith said: In article lsm8ic$j90$1...@online.de, Philipp Kraus philipp.kr...@flashpixx.de wrote: found = re.search( a href=\/projects/boost/files/latest/download\?source=files\ title=\/boost/(.*),

Re: string encoding regex problem

2014-08-15 Thread Roy Smith
In article lsmeej$49n$1...@online.de, Philipp Kraus philipp.kr...@flashpixx.de wrote: The code works till last week correctly, I don't change the pattern. OK, so what did you change? Can you go back to last week's code and compare it to what you have now to see what changed? My question

Re: string encoding regex problem

2014-08-15 Thread Steven D'Aprano
one? Did you update Python to a new version? Have you changed the regex search pattern? Has the text you are searching changed? Websites upgrade their HTML quite frequently. Perhaps the Boost website has changed enough to break your regex. -- Steven -- https://mail.python.org/mailman/listinfo

[issue2636] Adding a new regex module (compatible with re)

2014-06-26 Thread Mark Lawrence
Mark Lawrence added the comment: Will we actually get regex into the standard library on this pass? -- nosy: +BreamoreBoy versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636

[issue2636] Adding a new regex module (compatible with re)

2014-06-26 Thread Nick Coghlan
, tests and docs into CPython (not technically *hard*, but not trivial either). pip install regex starts looking fairly attractive at that point :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636

problem with regex

2014-04-28 Thread dimmaim
i want to find a specific urls from a txt file but i have some issus. First when i take just two lines from the file with copy paste and assign it to a variable like this and it works only with triple quotes

problem with regex

2014-04-28 Thread dimmaim
i want to find a specific urls from a txt file but i have some issus. First when i take just two lines from the file with copy paste and assign it to a variable like this and it works only with triple quotes

Re: problem with regex

2014-04-28 Thread Roy Smith
In article caeba811-441e-42a0-9b2b-c743205b1...@googlegroups.com, dimm...@gmail.com wrote: i want to find a specific urls from a txt file but i have some issus. First when i take just two lines from the file with copy paste and assign it to a variable like this and it works only with triple

Re:problem with regex

2014-04-28 Thread Dave Angel
dimm...@gmail.com Wrote in message: i want to find a specific urls from a txt file but i have some issus. First when i take just two lines from the file with copy paste and assign it to a variable like this and it works only with triple quotes

Re: regex line by line over file

2014-03-27 Thread James Smith
: print(len(line), line==line2, repr(line)) print(repr(pat.match(line))) which will show you what you have and whether or not it matches what you think it has. I expect that the file contents is not what you think it is, because the regex is matching the sample line. Good

Re: regex line by line over file

2014-03-27 Thread James Smith
On Thursday, March 27, 2014 9:41:55 AM UTC-4, James Smith wrote: (134, False, '\' SHELF-17:LOG_COLN_IP,SC,03-25,01-18-58,NEND,NA,,,:Log Collection In Progress,NONE:170035-6364-1048,:YEAR=2014,MODE=NONE\\r\\n\'') Is the \r\n on the end of the line screwing it up? Got it.

Re: regex line by line over file

2014-03-27 Thread Peter Pearson
it is, because the regex is matching the sample line. Good luck! -- Steven It should match this: (134, False, '\' SHELF-17:LOG[snip]MODE=NONE\\r\\n\'') Is the \r\n on the end of the line screwing it up? Dude, you've gotten a lot of excellent advice from some extraordinarily capable

regex line by line over file

2014-03-26 Thread James Smith
I can't get this to work. It runs but there is no output when I try it on a file. #!/usr/bin/python import os import sys import re from datetime import datetime #logDir = '/nfs/projects/equinox/platformTools/RTLG/RTLG_logs'; #os.chdir( logDir ); programName = sys.argv[0] fileName =

Re: regex line by line over file

2014-03-26 Thread Chris Angelico
On Thu, Mar 27, 2014 at 2:23 PM, James Smith bjloc...@lockie.ca wrote: re.M p = re.compile('^\s*\SHELF-.*,SC,.*,:\\\Log Collection In Progress\\\') If you're expecting this to be parsed as a multiline regex, it won't be. Probing re.M doesn't do anything on its own; you have to pass

Re: regex line by line over file

2014-03-26 Thread James Smith
On Wednesday, March 26, 2014 11:23:29 PM UTC-4, James Smith wrote: I can't get this to work. It runs but there is no output when I try it on a file. #!/usr/bin/python import os import sys import re from datetime import datetime #logDir =

Re: regex line by line over file

2014-03-26 Thread Rustom Mody
On Thursday, March 27, 2014 8:53:29 AM UTC+5:30, James Smith wrote: I can't get this to work. It runs but there is no output when I try it on a file. #!/usr/bin/python import os import sys import re from datetime import datetime #logDir =

Re: regex line by line over file

2014-03-26 Thread Chris Angelico
On Thu, Mar 27, 2014 at 3:14 PM, James Smith bjloc...@lockie.ca wrote: I tried the re.M in the compile and that didn't help. Okay. Try printing out the repr of the line at the point where you have the commented-out write to stdout. That might tell you if there's some other difference. At that

Re: regex line by line over file

2014-03-26 Thread Steven D'Aprano
, the problem is that your regex is not matching what you expect it to match. So eliminate all the irrelevant cruft that is just noise, complicating the problem. Start with the simplest thing that works and add complexity until the problem returns. Eliminate the file. You can embed your data in a string

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-03-25 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3f8b801e7e76 by R David Murray in branch '2.7': backport: #20145: assertRaisesRegexp now raises a TypeError on bad regex. http://hg.python.org/cpython/rev/3f8b801e7e76 New changeset 32407a677215 by R David Murray in branch '3.4': backport: #20145

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-03-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset ec556e45641a by R David Murray in branch 'default': #20145: assert[Raises|Warns]Regex now raise TypeError on bad regex. http://hg.python.org/cpython/rev/ec556e45641a -- nosy: +python-dev ___ Python

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-03-23 Thread R. David Murray
R. David Murray added the comment: Thanks, Kammie. I removed the extra whitespace from your fix and simplified the tests a bit. -- resolution: - fixed stage: test needed - committed/rejected status: open - closed ___ Python tracker

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-03-19 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20145 ___ ___ Python-bugs-list

Find and replace multiple RegEx search expressions

2014-03-18 Thread Jignesh Sutar
Hi, I'm trying to delete contents of a .txt log file, matching on multiple re.sub criteria but not sure how to achieve this. Below is an illustration of what I am trying to achieve (of course in this example I can combine the 3 re.sub into a single re expression but my actual code will have a

Re: Find and replace multiple RegEx search expressions

2014-03-18 Thread Peter Otten
Jignesh Sutar wrote: Hi, I'm trying to delete contents of a .txt log file, matching on multiple re.sub criteria but not sure how to achieve this. Below is an illustration of what I am trying to achieve (of course in this example I can combine the 3 re.sub into a single re expression but

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-03-12 Thread the mulhern
the mulhern added the comment: Thanks, I'ld definitely be _much_ happier w/ a TypeError than with silent success. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20145 ___

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-03-11 Thread Kamilla
Kamilla added the comment: Applying changes as suggested by R. David Murray in the Core-mentorship e-mail list. Instead of doing the if tests I've replaced the existing if isinstance(expected_regex, (bytes, str)): by if expected_regex is not None: And also made a change in one of

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-03-10 Thread Kamilla
Kamilla added the comment: I've implemented a piece of code to check if the expected_regex is a string or regex object. If it's not it raises a TypeError exception. The check is inside the __init__ method of the _AssertRaisesBaseContext class so it will always check the expected_regex in all

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-03-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: A simple way of checking is to actually re.compile(regex), I think. It should automatically raise TypeError on invalid input. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-03-09 Thread R. David Murray
R. David Murray added the comment: Heh. If unittest had used duck typing instead of isinstance for its string-to-regex conversion check in the first place, this issue wouldn't even have come up. -- nosy: +r.david.murray ___ Python tracker rep

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-03-08 Thread Michael Foord
Michael Foord added the comment: That's correct. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20145 ___ ___ Python-bugs-list mailing list

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-03-07 Thread Kamilla
Kamilla added the comment: Just to be sure, the check must be implemented inside the assertRaisesRegex method, right? -- nosy: +kamie ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20145 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset 52743dc788e6 by Serhiy Storchaka in branch '3.3': Issue #20283: RE pattern methods now accept the string keyword parameters http://hg.python.org/cpython/rev/52743dc788e6 New changeset f4d7abcf8080 by Serhiy Storchaka in branch 'default': Issue

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset 52256a5861fa by Serhiy Storchaka in branch '2.7': Issue #20283: RE pattern methods now accept the string keyword parameters http://hg.python.org/cpython/rev/52256a5861fa -- ___ Python tracker

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-06 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka resolution: - fixed stage: patch review - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-06 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a test. -- Added file: http://bugs.python.org/file34290/test_re_keyword_parameters.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-04 Thread STINNER Victor
STINNER Victor added the comment: We are close to Python 3.4 final, so what is the status of this issue? I don't see any commit and nothing to cherry-pick in Larry's 3.4.0 repository. -- nosy: +haypo ___ Python tracker rep...@bugs.python.org

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-04 Thread Martin v . Löwis
Martin v. Löwis added the comment: Since there is no consensus on how to resolve this issue, I'm dropping the release-critical status for it; people should now consider whether a future agreed-upon solution could apply to 3.4.1 or just to 3.5. -- priority: release blocker - normal

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-04 Thread Martin v . Löwis
Martin v. Löwis added the comment: Serhiy: the patch is incomplete; it lacks test cases. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-03 Thread Martin v . Löwis
Martin v. Löwis added the comment: The patch sre_deprecate_pattern_keyword-3.4.patch looks good to me. I *think* that Larry has pre-approved it for 3.4. If it is applied, and if people still think that 2.7 and 3.3 need to be changed, the release-critical status should be removed from the

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-03 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The disadvantage of sre_deprecate_pattern_keyword-3.4.patch is that it creates false signature for SRE_Pattern.match(). Default value of first argument is exposed as None, but actually this parameter is mandatory and None is not valid value for it. I afraid

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-03 Thread Larry Hastings
Larry Hastings added the comment: Why can't you remove the = NULL from the Clinic input for string? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-03-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Why can't you remove the = NULL from the Clinic input for string? Because this will prohibit the use of pattern as keyword argument. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-02-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch with the show_in_signature hack for 3.4. -- priority: normal - release blocker Added file: http://bugs.python.org/file34216/sre_deprecate_pattern_keyword-3.4.patch ___ Python tracker

[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-02-17 Thread the mulhern
the mulhern added the comment: Yes. I'ld check if it was a string or a regex object...there is already code that converts the string to a regular expression in there. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20145

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-02-09 Thread Larry Hastings
Larry Hastings added the comment: Use #3. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___ ___ Python-bugs-list mailing list

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-02-09 Thread Larry Hastings
Larry Hastings added the comment: pattern should be keyword-only, and if used the function should generate a DeprecationWarning. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-02-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Larry, so what is your decision? 1. Apply the hard patch and then convert Modules/_sre.c to use Argument Clinic (issue20148). 2. Revert converted match() method, apply the soft patch, and delay applying of the hard patch and then converting to use Argument

[issue20426] Compiling a regex with re.DEBUG should force a recompile

2014-02-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset a7b180d5df5f by Antoine Pitrou in branch '3.3': Issue #20426: When passing the re.DEBUG flag, re.compile() displays the debug output every time it is called, regardless of the compilation cache. http://hg.python.org/cpython/rev/a7b180d5df5f New

[issue20426] Compiling a regex with re.DEBUG should force a recompile

2014-02-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset e47f6883dedf by Antoine Pitrou in branch '2.7': Issue #20426: When passing the re.DEBUG flag, re.compile() displays the debug output every time it is called, regardless of the compilation cache. http://hg.python.org/cpython/rev/e47f6883dedf

[issue20426] Compiling a regex with re.DEBUG should force a recompile

2014-02-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, I've fixed the bug in all branches. Thanks for reporting! -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue20426] Compiling a regex with re.DEBUG should force a recompile

2014-02-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: A simple workaround is to bypass the cache when DEBUG is passed. See attached patch. (not sure this applies as a bug fix, but DEBUG probably isn't used in production anyway: the potential for breakage is low) -- keywords: +patch stage: test needed -

[issue20426] Compiling a regex with re.DEBUG should force a recompile

2014-01-28 Thread leewz
New submission from leewz: Compiling a regex with the `re.DEBUG` flag indicates that the user wants to see the debug output. `re.compile` is cached, though, so there is the possibility of no output. Example: import re re.compile('1',re.DEBUG) #expected output re.compile('1',re.DEBUG

[issue20426] Compiling a regex with re.DEBUG should force a recompile

2014-01-28 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- stage: - test needed versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20426 ___

[issue20426] Compiling a regex with re.DEBUG should force a recompile

2014-01-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue17441. -- nosy: +pitrou, serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20426 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The patch did not upload correctly. Oh, sorry. Here is correct patch. I propose to apply soft patch (which preserves support for old keyword parameter name) to 2.7 and 3.3, and apply hard patch (which just renames keyword parameter name) to 3.4. Or we

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-26 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: Removed file: http://bugs.python.org/file33705/sre_deprecate_pattern_keyword.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-26 Thread Georg Brandl
Georg Brandl added the comment: For 3.3 I prefer the soft patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___ ___ Python-bugs-list

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-26 Thread Larry Hastings
Larry Hastings added the comment: Georg: you're accepting this patch into 3.3? I'm surprised. I would only want the soft approach. But I haven't said yes yet. I want to discuss it a little more. (Hey, it's python core dev. Discussing things endlessly is our job.) --

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If you want the soft approach, then you should revert your changes to _sre.SRE_Pattern.match. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-26 Thread Larry Hastings
Larry Hastings added the comment: You can do it, if I accept the patch for 3.4. There's no point in doing it in two stages. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-26 Thread Larry Hastings
Larry Hastings added the comment: Alternatively, we could use this cheap hack: /*[python input] class hidden_object_converter(object_converter): show_in_signature = False [python start generated code]*/ /*[clinic input] module _sre class _sre.SRE_Pattern PatternObject * Pattern_Type

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is patch for 3.3 which adds alternative parameter name. Now both keyword names are allowed, but deprecation warning is emitted if old keyword name is used. import re p = re.compile('') p.match() Traceback (most recent call last): File stdin, line

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-25 Thread Terry J. Reedy
Terry J. Reedy added the comment: Great. Old and new both in at least one release, when possible, is best. I should have thought of asking if that would be possible. In this case, I think the (undocumented) old should disappear in 3.5. Since the mistaken 'pattern' name is not documented now,

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-23 Thread Tal Einat
Changes by Tal Einat talei...@gmail.com: -- nosy: +taleinat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___ ___ Python-bugs-list mailing

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Actually, several other methods also have wrong parameter name, source instead of string. -- stage: needs patch - patch review Added file: http://bugs.python.org/file33598/sre_pattern_string_keyword.patch ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file33509/sre_pattern_string_keyword.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +mrabarnett ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283 ___ ___ Python-bugs-list

[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-21 Thread Terry J. Reedy
Terry J. Reedy added the comment: If no one else pipes up here, perhaps ask on pydef about changing C names to match documented names. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20283

<    3   4   5   6   7   8   9   10   11   12   >