Issue 9217: 2to3 crashes with some doctests (original) (raw)

Created on 2010-07-10 19:27 by tiagoantao, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
DocSQL.py tiagoantao,2010-07-10 19:50
2to3_log_fix.patch jerith,2010-09-04 16:41 Fix self.log crash in 2to3
Messages (10)
msg109911 - (view) Author: Tiago Antao (tiagoantao) * Date: 2010-07-10 19:27
2to3 -d sometimes crashes. The problem seems to be in refactor_doctest. The problematic line is: if self.log.isEnabledFor(logging.DEBUG): self.log does not exist. The error, as expected: File "/usr/lib/python3.1/lib2to3/refactor.py", line 516, in refactor_doctest if self.log.isEnabledFor(logging.DEBUG): AttributeError: 'StdoutRefactoringTool' object has no attribute 'log'
msg109916 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-07-10 19:45
Fixed in r82779. I'm curious as to what it's failing on.
msg109917 - (view) Author: Tiago Antao (tiagoantao) * Date: 2010-07-10 19:50
Benjamin, Thanks for the fast answer. I attach the problematic file. This file is from Biopython. We are trying to have a Python 3 version of it. We applied 2to3 (no -d) first (via distutils on setup.py build) and I was applying 2to3 -d manually after it.
msg109925 - (view) Author: Tiago Antao (tiagoantao) * Date: 2010-07-10 20:03
BTW, this happens in 2.6 also
msg109988 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-07-11 10:32
Could it be because of the escaped triple quotes?
msg110023 - (view) Author: Tiago Antao (tiagoantao) * Date: 2010-07-11 16:13
A few more problematic examples (hope it helps) >>> my_mseq = MutableSeq("MKQHKAMIVALIVICITAVVAAL", \ IUPAC.protein) Note the line continuation >>> rec.letter_annotations["secondary_structure"] = \ (The same pattern) Another (different) """Returns a simple text representation of the codon table e.g. >>> import Bio.Data.CodonTable >>> print Bio.Data.CodonTable.standard_dna_table >>> print Bio.Data.CodonTable.generic_by_id[1]""" And (the original) >>> class CreatePeople(DocSQL.Create): ... \""" ... CREATE TEMPORARY TABLE people ... (id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, ... last_name TINYTEXT, ... first_name TINYTEXT) ... \""" ... Hope it helps
msg110025 - (view) Author: Tiago Antao (tiagoantao) * Date: 2010-07-11 16:27
Another example >>> records = (record for record in \ SeqIO.parse("Roche/E3MFGYR02_random_10_reads.sff","sff") \ if record.seq[record.annotations["cli [...] Note that ... does not apply here (it will fail on python2 doctests)
msg110262 - (view) Author: Tiago Antao (tiagoantao) * Date: 2010-07-14 09:54
I've re-opened this bug because of the late examples that I've included that still crash. I can open a new bug if you prefer with the late examples (just tell me and I will open a new bug). This is somewhat important for us: In order to be able to release a Python3 version of biopython we need to have 2to3 doctest processing working.
msg111811 - (view) Author: Peter (maubp) Date: 2010-07-28 13:56
Reverted accidental title change - had keyboard focus on the page not the address bar I think. Sorry!
msg115588 - (view) Author: Jeremy Thurgood (jerith) Date: 2010-09-04 16:41
This seems to be fixed in 3.2 and the 2.7 maintenance branch, but here's a (one-liner) patch for people who want to fix their local installations.
History
Date User Action Args
2022-04-11 14:57:03 admin set github: 53463
2010-09-05 18:03:52 eric.araujo set status: open -> closedstage: resolved
2010-09-04 16:41:47 jerith set files: + 2to3_log_fix.patchnosy: + jerithmessages: + keywords: + patch
2010-07-28 13:56:19 maubp set messages: + title: 2to3 doctests -> 2to3 crashes with some doctests
2010-07-28 13:55:06 maubp set title: 2to3 crashes with some doctests -> 2to3 doctests
2010-07-28 13:55:00 maubp set nosy: + maubp
2010-07-14 09:54:10 tiagoantao set status: closed -> openmessages: +
2010-07-11 16:27:37 tiagoantao set messages: +
2010-07-11 16:13:06 tiagoantao set messages: +
2010-07-11 10:32:30 eric.araujo set nosy: + eric.araujomessages: +
2010-07-10 20:03:20 tiagoantao set messages: + versions: + Python 2.6
2010-07-10 19:50:57 tiagoantao set files: + DocSQL.pymessages: +
2010-07-10 19:45:40 benjamin.peterson set status: open -> closednosy: + benjamin.petersonmessages: + resolution: fixed
2010-07-10 19:29:50 tiagoantao set type: crash
2010-07-10 19:27:48 tiagoantao create