-
Notifications
You must be signed in to change notification settings - Fork 219
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
Mutable" no longer being used #727
Closed
salman2013
wants to merge
4
commits into
openedx:master
from
salman2013:salman/remove-mutable-property
Closed
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -703,7 +703,7 @@ def test_setting_the_same_value_marks_field_as_dirty(): | |
# pylint: disable=unsubscriptable-object | ||
class FieldTester(XBlock): | ||
"""Test block for set - get test.""" | ||
non_mutable = String(scope=Scope.settings) | ||
# non_mutable = String(scope=Scope.settings) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have you commented them rather than removing them? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i mistakenly left them, i have removed them. |
||
list_field = List(scope=Scope.settings) | ||
dict_field = Dict(scope=Scope.settings) | ||
|
||
|
@@ -714,17 +714,17 @@ class FieldTester(XBlock): | |
assert len(field_tester._dirty_fields) == 0 | ||
assert not field_tester.fields['list_field'].is_set_on(field_tester) | ||
assert not field_tester.fields['dict_field'].is_set_on(field_tester) | ||
assert not field_tester.fields['non_mutable'].is_set_on(field_tester) | ||
# assert not field_tester.fields['non_mutable'].is_set_on(field_tester) | ||
|
||
field_tester.non_mutable = field_tester.non_mutable | ||
# field_tester.non_mutable = field_tester.non_mutable | ||
field_tester.list_field = field_tester.list_field | ||
field_tester.dict_field = field_tester.dict_field | ||
|
||
assert not field_tester.fields['non_mutable'] in field_tester._dirty_fields | ||
# assert not field_tester.fields['non_mutable'] in field_tester._dirty_fields | ||
assert field_tester.fields['list_field'] in field_tester._dirty_fields | ||
assert field_tester.fields['dict_field'] in field_tester._dirty_fields | ||
|
||
assert not field_tester.fields['non_mutable'].is_set_on(field_tester) | ||
# assert not field_tester.fields['non_mutable'].is_set_on(field_tester) | ||
assert not field_tester.fields['list_field'].is_set_on(field_tester) | ||
assert not field_tester.fields['dict_field'].is_set_on(field_tester) | ||
|
||
|
Oops, something went wrong.
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 was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, looking at this more closely, there might be a memory usage implication for this change. It may produce more copies of the defaults than we want for certain objects. Perhaps this is something we need to keep after all.
My thought is this: If whenever we ask for the default value of certain fields, it makes a new copy of the default value via
deepcopy
then we will increase the memory usage of the application each time a new default is loaded. Given that these are fields in xblocks, that might happen quite a bit, so I wonder if it actually makes more sense to not make this change and instead decide that we're happy with the code as is. @salman2013 @farhan what do you guys think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@feanil I think your point of increasing memory usage makes sense and we should not make this change, actually when i removed it the perception in my mind was the value MUTABLE is true by default
and its already making a deep copy and maybe it would be for some reason but yeah your point is valid it would increase app memory size whenever it is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's abandon this PR and close the related issue with a link to this PR and a summary of the reason why we did not pursue it.