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

Moved RuntimeError from initialisation of Dummy ctype to where the va… #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
9 changes: 7 additions & 2 deletions ads/adssymbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class Dummy(Array):
_length_ = 1
_type_ = c_ubyte
def __init__(self, *args):
raise RuntimeError('Dummy ctypes object cannot be created or written')
pass # moved RuntimeError to where the variable is written
Copy link
Member

Choose a reason for hiding this comment

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

This comment does not belong in the code, it is in the GIT history. This whole __init__ can now be removed.

# raise RuntimeError('Dummy ctypes object cannot be created or written')
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this commented line.


class Entry:
"""
Expand Down Expand Up @@ -517,6 +518,8 @@ class constructor.
else:
# Write
assert self.__ctype is not None
if isinstance( self.__cype, Dummy ):
raise RuntimeError('Dummy ctypes object cannot be created or written')
if len(args) == 1 and len(kwargs)==0 and isinstance(args[0], self.__ctype):
# We have exactly one argument, which is of the correct type
data = args[0]
Expand Down Expand Up @@ -669,7 +672,9 @@ def getCtype(self, dtypename, size = None):

self.ctypes[dtypename] = ctype
return ctype




def getVariables(netId = None, port = 851):
cpyads.adsPortOpen()

Expand Down