Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove U flag for python 3 and up #162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
test*.py
Krakatau/plugins/*
tests/.cache
.idea/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intellij IDEA settings. Some files can be committed but this just ignores the folder.

7 changes: 6 additions & 1 deletion assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import print_function

import os.path, time
import sys

import Krakatau
from Krakatau.assembler import parse
Expand All @@ -13,7 +14,11 @@ def assembleSource(source, basename, fatal=False):

def assembleClass(filename):
basename = os.path.basename(filename)
with open(filename, 'rU') as f:
if sys.version_info < (3,):
mode = 'rU'
else: # python 3 deprecates mode "U" in favor of "newline" option
mode = 'r'
with open(filename, mode) as f:
source = f.read()
return assembleSource(source, basename)

Expand Down