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

Begin development for Python 3 #143

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

kcg295
Copy link

@kcg295 kcg295 commented Feb 9, 2021

This pull request begins development for a Python 3 port of repy. It is an incomplete port, so I recommend it be merged into a new branch so development can continue.

This port was motivated by porting assignments using repy to python 3. As such, not every feature of repy was ported, and many were knowingly removed. This will need to be fixed for a complete port.

Kevin Gallagher and others added 6 commits June 11, 2020 17:03
Copy link
Contributor

@JustinCappos JustinCappos left a comment

Choose a reason for hiding this comment

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

Lots of little comments. I had a lot of thoughts that I could have applied over and over but just flagged the first instance...


# Store a file handle
# Always open in mode r+b, this avoids Windows text-mode
# quirks, and allows reading and writing
self.fobj = safe_open(self.abs_filename, "r+b")
self.fobj = open(self.abs_filename, "r+")
Copy link
Contributor

Choose a reason for hiding this comment

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

This almost certainly breaks the security of the system.

@@ -336,7 +336,7 @@ def close(self):
OPEN_FILES_LOCK.acquire()

# Tell nanny we're gone.
nanny.tattle_remove_item('filesopened', self.abs_filename)
#nanny.tattle_remove_item('filesopened', self.abs_filename)
Copy link
Contributor

Choose a reason for hiding this comment

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

the nanny call removals are also likely a security concern.

@@ -386,7 +386,7 @@ def readat(self,sizelimit,offset):
end of the file, or if the sizelimit was 0.
"""
# Check the arguments
if sizelimit < 0 and sizelimit != None:
if sizelimit != None and sizelimit < 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this edit?

@@ -464,6 +464,7 @@ def writeat(self,data,offset):
raise RepyArgumentError("Negative read offset speficied!")
if type(data) is not str:
raise RepyArgumentError("Data must be specified as a string!")
#data = data.encode('utf-8')
Copy link
Contributor

Choose a reason for hiding this comment

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

Should likely be removed.

Suggested change
#data = data.encode('utf-8')

@@ -26,7 +26,7 @@
import nonportable # for getruntime
import harshexit # for harshexit()
import threading # for Lock()
import thread # to catch thread.error
import _thread as thread # to catch thread.error
Copy link
Contributor

Choose a reason for hiding this comment

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

Why?

@@ -1,4 +1,5 @@
"""
irint(str(newcontext))
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug?

@@ -48,3 +48,4 @@
"169.229.131.81", # Berkley
"140.142.12.202"] # Univ. of Washington


Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

@@ -82,31 +82,32 @@
import sys # This is to get sys.executable to launch the external process
import time # This is to sleep

# Currently required to filter out Android-specific debug messages,
Copy link
Contributor

Choose a reason for hiding this comment

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

This whole module will need to be rethought most likely.

https://github.com/SeattleTestbed/affix ../DEPENDENCIES/affix
https://github.com/SeattleTestbed/common ../DEPENDENCIES/common
https://github.com/SeattleTestbed/utf ../DEPENDENCIES/utf
https://github.com/kcg295/seattlelib_v2 ../DEPENDENCIES/seattlelib_v2
Copy link
Contributor

Choose a reason for hiding this comment

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

Will need to be changed. Likely should be a parameter...

# see SeattleTestbed/repy_v1#120.
# This causes tracebacks to have an inaccurate line number, so we adjust
# them in multiple modules. See SeattleTestbed/repy_v2#95.
code = encoding_header.ENCODING_DECLARATION + code
Copy link
Contributor

Choose a reason for hiding this comment

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

This likely needs to be retained for security reasons.

@JustinCappos JustinCappos mentioned this pull request Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants