Skip to content

Buffer updates#439

Merged
slozier merged 8 commits intoIronLanguages:masterfrom
slide:buffer_updates
Jul 8, 2018
Merged

Buffer updates#439
slozier merged 8 commits intoIronLanguages:masterfrom
slide:buffer_updates

Conversation

@slide
Copy link
Copy Markdown
Contributor

@slide slide commented Jul 8, 2018

No description provided.

sendallWorker(data.byteCache, flags);
}

[Documentation("sendall(string[, flags]) -> None\n\n"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need the full doc on this overload?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure how the doc stuff works in regards to something like help(_socket.sendall), we probably don't, but I kept it there like the other overloads.

Comment thread Src/IronPython/Runtime/ByteArray.cs Outdated
}

public static ByteArray operator +(ByteArray self, string other) {
if(other.Any(x => x > 0xff)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

MakeByteArray below does the same check as this. Maybe we could try catch the MakeByteArray and throw if necessary? Or if we don't want a try catch we could add a TryMakeByteArray which wouldn't throw.

Also, I wonder if we should add a note that this overload is specifically a workaround for the IPy string are unicode issue.

}

void IBufferProtocol.SetItem(int index, object value) {
throw PythonOps.TypeError("cannot modify read - only memory");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

spaces: read - only

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks

return _size;
}
}
internal int Size { get; private set; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe not worth the effort, but it seems like _object and Size should be readonly.

@slozier
Copy link
Copy Markdown
Contributor

slozier commented Jul 8, 2018

Can we add some tests for all this stuff?

@slide
Copy link
Copy Markdown
Contributor Author

slide commented Jul 8, 2018

I have another PR coming that will enable tests for this, but its part of a small rework to the testing stuff.

@slozier slozier merged commit 51c645c into IronLanguages:master Jul 8, 2018
dpmdpm pushed a commit to dpmdpm/ironpython2 that referenced this pull request Aug 2, 2018
* Small updates

* Buffer updates

* Fix IronLanguages#434

* Fix spaces

* Add TryMakeByteArray

* Switch to using TryMakeByteArray
slozier added a commit to slozier/ironpython3 that referenced this pull request Aug 23, 2018
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.

2 participants