Fix ValueError thrown on specific byte sequence#4
Closed
adamsqi wants to merge 3 commits intodlenski:masterfrom
Closed
Fix ValueError thrown on specific byte sequence#4adamsqi wants to merge 3 commits intodlenski:masterfrom
adamsqi wants to merge 3 commits intodlenski:masterfrom
Conversation
Fix '\r\n' in mixed mode
Owner
|
This PR doesn't apply to the |
Author
|
@dlenski |
Owner
|
As far as I can tell, the only part of the changes here that are actually relevant to the stated purpose are the following lines: diff --git a/aztec_code_generator.py b/aztec_code_generator.py
index 65bbb28..844b8b5 100644
--- a/aztec_code_generator.py
+++ b/aztec_code_generator.py
@@ -351,7 +353,8 @@ def find_optimal_sequence(data):
last_mode = abbr_modes.get(char.replace('/S', '').replace('/L', ''))
break
if last_mode == 'punct':
- if cur_seq[x][-1] + c in punct_2_chars:
+ # do not use mixed mode for '\r\n' as in mixed mode '\r' and '\n' are separate
+ if cur_seq[x][-1] + c in punct_2_chars and x != 'mixed':
if cur_len[x] < next_len[x]:
next_len[x] = cur_len[x]
next_seq[x] = cur_seq[x][:-1] + [cur_seq[x][-1] + c]Do you agree with that? |
Author
|
@dlenski |
dlenski
added a commit
that referenced
this pull request
Dec 8, 2022
There is a bug where we attempt to encode '\r\n' in an impossible way in MIXED mode; see delimitry#7 I'm not convinced that the solution from #4 is a very clarifying or complete one. For now, just add a test which demonstrates the problem, and is marked as expectedFailure.
dlenski
added a commit
that referenced
this pull request
Dec 8, 2022
There is a bug where we attempt to encode '\r\n' in an impossible way in MIXED mode; see delimitry#7 I'm not convinced that the solution from #4 is a very clarifying or complete one. For now, just add a test which demonstrates the problem, and is marked as expectedFailure.
Owner
dlenski
added a commit
that referenced
this pull request
Dec 8, 2022
There is a bug where we attempt to encode '\r\n' in an impossible way in MIXED mode; see delimitry#7 I'm not convinced that the solution from #4 is a very clarifying or complete one. For now, just add a test which demonstrates the problem, and is marked as expectedFailure.
dlenski
added a commit
that referenced
this pull request
Dec 8, 2022
There is a bug where we attempt to encode '\r\n' in an impossible way in MIXED mode; see delimitry#7 I'm not convinced that the solution from #4 is a very clarifying or complete one. For now, just add a test which demonstrates the problem, and is marked as expectedFailure.
Author
|
@dlenski |
dlenski
added a commit
that referenced
this pull request
Dec 17, 2024
See #4. I thought there'd be a more elegant fix here, but in the end I went with the same one as inhttps://github.com/delimitry/pull/8/files#diff-bf7c11e2b0865687a2785c4fa2a55920d92137aa2b6548c5f87835d98f73339fR356-R357
dlenski
added a commit
that referenced
this pull request
Dec 17, 2024
See #4. I thought there'd be a more elegant fix here, but in the end I went with the same one as inhttps://github.com/delimitry/pull/8/files#diff-bf7c11e2b0865687a2785c4fa2a55920d92137aa2b6548c5f87835d98f73339fR356-R357
dlenski
added a commit
that referenced
this pull request
Dec 17, 2024
See #4. I thought there'd be a more elegant fix here, but in the end I went with the same one as in https://github.com/delimitry/aztec_code_generator/pull/8/files#diff-bf7c11e2b0865687a2785c4fa2a55920d92137aa2b6548c5f87835d98f73339fR356-R357
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is this issue that appears in the recent version of the package:
The bug has been fixed in the recent version of https://github.com/delimitry/aztec_code_generator
More about the issue and the fix: delimitry#7